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 » Scripters
Home Search
 

Re: MoveTo() Function Not Working

Previous Thread :: Next Thread 
crazybikerdude3 is not online. crazybikerdude3
Joined: 16 May 2011
Total Posts: 34
03 Aug 2016 04:33 PM
Hi there,

I have been trying to create a GUI that allows for the purchase of a car. I have successfully completed this part. However, I now want to have the car spawn at the player's torso position, but can't seem to figure it out. Here's the LocalScript that I have:



local car = game.Lighting.StandardCar:Clone()

script.Parent.MouseButton1Click:connect(function(onClick)
car.Parent = game.Workspace
car:MakeJoints()
car:MoveTo(game.Workspace.Name.Torso.Position) <-------This is the issue I cant seem to figure out.



end)




Report Abuse
j1sh is not online. j1sh
Joined: 31 Jul 2016
Total Posts: 289
03 Aug 2016 04:34 PM
You need to set the PrimaryPart of the car model.
Report Abuse
crazybikerdude3 is not online. crazybikerdude3
Joined: 16 May 2011
Total Posts: 34
03 Aug 2016 04:36 PM
To clarify, I can't seem to figure out how to access the player who clicked in workspace.


Report Abuse
peIicans is not online. peIicans
Joined: 02 Nov 2013
Total Posts: 1148
03 Aug 2016 04:37 PM
use localscript

plr = game.Players.LocalPlayer

car:MoveT(plr.Character.Torso.Position)


Report Abuse
j1sh is not online. j1sh
Joined: 31 Jul 2016
Total Posts: 289
03 Aug 2016 04:37 PM
Since it's in a localscript you can use "game.Players.LocalPlayer.Character".

Keep in mind it will not work with FilteringEnabled.
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
03 Aug 2016 04:37 PM
does this make u
>:OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

am harambe
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
03 Aug 2016 04:38 PM
No, you dont need to set a primary part.

Also does the car go into workspace at all, but wont move to the location?
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
03 Aug 2016 04:38 PM
did you change "Name" to whatever the name of the thing your trying to move it to is?
Report Abuse
crazybikerdude3 is not online. crazybikerdude3
Joined: 16 May 2011
Total Posts: 34
03 Aug 2016 04:40 PM
The car does go into Workspace, just it appears at the position it was in when put into Lighting.


Report Abuse
crazybikerdude3 is not online. crazybikerdude3
Joined: 16 May 2011
Total Posts: 34
03 Aug 2016 04:43 PM
Thank you @pelicans, it worked.


Report Abuse
crazybikerdude3 is not online. crazybikerdude3
Joined: 16 May 2011
Total Posts: 34
03 Aug 2016 04:44 PM
And thanks to the rest of you for helping!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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