Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Teleporting Models Help?

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)

2 comments

0

see question 15436

0

you have a link to that?

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.