Jump to content

[HELP]attach is not working


Recommended Posts

Posted (edited)

Hi guys! I want to make a script like : when i use the item then the script attcahes a kevlar vest to my character , but it's not working :/

the code : 

 

elementVest = {}

function createVest ()
	 x,y,z = getElementPosition(source)
 	elementVest[source] = createObject(1242,x,y,z)
 	exports.bone_attach:attachElementToBone(elementVest[source],source,3,0,0,0,3,-5,0)
 
 	setElementCollisionsEnabled(elementVest[source], false)
 	setObjectScale(elementVest[source], 1.2)
 
end
addEvent("createVest", true)
addEventHandler("createVest", getRootElement(), createVest)

 

 

debugscript says:[ERROR][string"?"]attempt to call global 'type' (a number value)

Edited by DarkMagic
..
Posted

It doesn't seem like you've posted the part with line 34, or if you did, please tell us which of the snippet is line 34.

Previously known as MrTasty.

Posted

The full script has 945 line … there is no problem with the 34th line . but if i use this "function" debug says that .

If u use attachElement instead of attachElementToBone then it works

But the attachElement is not that good , cause when i crouch then the object stays in the air, but if i run the object "follows" me but not attaches to my character!

 

  • Moderators
Posted

You have overwritten the function called 'type'.
And since exports table uses that its :Oed.
Submitted a PR right now. :)

Just rename the variable in you script from 'type' to something else.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...