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

Why isnt this Teleport script working?

So i want it so when i click this part (the parent of the script) it teleports to the coordinates. im not sure if it just doesnt know what the parent of click is or im doing it wrong completely

local ClickDetector = script.Parent.ClickDetector

ClickDetector.MouseClick:connect(function(click)
	
	click.Parent:FindFirstChild("Torso")
	click.Parent.CFrame = CFrame.new(-115, 459, 128)
	
	
end)

1 answer

✓ Accepted answer

If your trying to move the part its self which is what your making it sound like try:

function onClicked()
script.Parent.CFrame = CFrame.new(Vector3.new(10,10,10))
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

If that's what your trying to accomplish I don't know why you referenced the Torso.

If your trying to move the player then use this:

function onClicked(p)
p.Character:MoveTo(Vector3.new(10,10,10))
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Don't forget to change the Cord's.

2 comments

0

thanks! I havent mastered MoveTo yet!

0

Welcome, its a esay to use API for moving the character of a player.

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