Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Teleporting Models Help?

Asked by
TrollD3 105
9 years ago

I want to make a gui that when they click a button, a car spans next to them Idk how to teleport models but I tried in the script below and of course is isn't working.

function OnClicked() 
for i, v in pairs(game.Workspace) do v.Car.CFrame = CFrame.new(Vector3.new(50, 50, 50)) -- Change numbers to whatever end

end
script.Parent.MouseButton1Down:connect(OnClicked)
0
see question 15436 BSIncorporated 640 — 9y
0
you have a link to that? TrollD3 105 — 9y

1 answer

Log in to vote
0
Answered by
SurVur 86
9 years ago

First of all, you don't have anything to check to make sure that there is something called "Car" as a child to the child of workspace. Assuming that "Car" is a model, you'll need to utilize :MoveTo() or :SetPrimaryPartCFrame().

Make sure you set the Primary Part of "Car" somehow before using the methods. Also, you created a CFrame with an already explicit Vector3. There is really no point to that, you can just do: CFrame.new(50, 50, 50)

Ad

Answer this question