generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Vector3.new Troubleshoot

Previous Thread :: Next Thread 
currydude is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
PRESTIGIOUSaLEGEND is not online. PRESTIGIOUSaLEGEND
Joined: 16 Apr 2011
Total Posts: 1765
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image