currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 10:50 AM |
So basically I have a localScript that when fired off will attach a sword to the players hand (It's in a gui) much like a morph. The sword is moved to the player just fine in the centre of their arm. However I then go to move it into the hand position with
sword.Position = sword.Position - Vector3.new(0, 1, 0)
But this does not work, It just moves it up 1 brick!?
I have also tried changing the - to a + and the 1 to a -1.
Help greatly appreciated. Many Thanks Currydude. |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 10:51 AM |
| sword.Position = sword.Position - CFrame.new(0, 1, 0) |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 10:55 AM |
| Nope, CFrame won't work because you need Vector3 |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 10:57 AM |
Sword.CFrame = Sword.CFrame - CFrame.new(0, 1, 0)
fixes^
vectors will move it above a block if it collides with said block. |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:00 AM |
Didn't work I'm afraid, got this error:
bad argument #2 to '?' (Vector3 expected, got userdata) |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 11:01 AM |
Mar I don't think that'd work either. Second argument always needs to be vector3.
Sword.CFrame = Sword.CFrame - Vector3.new(0, 1, 0) |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2014 11:02 AM |
| (0,1,0) is change in the y axis? try (1,0,0) or (0,0,1)? |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 11:03 AM |
Is the part names sword? or is the sword a tool?
if it's a tool then it would be
sword.Handle.CFrame |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:04 AM |
| Replacing CFrame.new with Vector3.new works, but instead of moving just the sword placed in the player model, it moves the whole player -1 :/ |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 11:05 AM |
| This is because the sword is still welded so the player follows the weld |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:05 AM |
Also it's just a part name, not a tool... Sorry, should've mentioned that.
It's held in lighting, copied over just as a brick with a mesh into game.(player folder) |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:06 AM |
| Oh ok, so I should either undo and the redo the weld, or have it fire off beforehand. |
|
|
| Report Abuse |
|
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 08 Mar 2014 11:07 AM |
| How exactly is the player holding it if it's not a tool? |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:08 AM |
| I've set it up like a mesh, it just moves to the player folder then welds itself in place. |
|
|
| Report Abuse |
|
|
currydude
|
  |
| Joined: 06 Dec 2008 |
| Total Posts: 656 |
|
|
| 08 Mar 2014 11:08 AM |
| Correction, Like a morph, not like a mesh XD |
|
|
| Report Abuse |
|
|