|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 03 Aug 2016 04:37 PM |
does this make u >:OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
am harambe |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 03 Aug 2016 04:43 PM |
Thank you @pelicans, it worked.
|
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 04:44 PM |
And thanks to the rest of you for helping!
|
|
|
| Report Abuse |
|
|