I've looked at Youtube videos to try to help me in my struggle, and use their scripts, but none of them are working. Please help!
✓ ANSWER ACCEPTED
How do you teleport players when they click a button?
2 answers
✓ Accepted answer
It'd probably go something like this, maybe it'll help you understand?
-- Declare a position to teleport to
local TeleportPos = Vector3.new(0, 5, 0)
local Btn = script.Parent -- Declare a variable for the button
Btn.ClickDetector.MouseClick:connect(function(PlayerWhoClicked)
-- Teleport the Character of 'PlayerWhoClicked' to the Teleport Position 'TeleportPos'
PlayerWhoClicked.Character:MoveTo(TeleportPos)
end)
Maybe use the MoveTo function?
Something like
function tpPlayer()
however.You.Find.LocalPlayer:MoveTo(x, y, z) -- Idk how to find players on clicks; I'm not good with tables or GetChildren for the matter
end
script.Parent.ClickDetector.MouseClick:connect(tpPlayer) --assuming the script is within the button and there is a ClickDetector in it
This is really crappy code though. I made it on an iPad at school :P
1 comment
0
Lol :P thanks for trying!!!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This is what I was going for. Forgot to use Vector3 :P
When in doubt check the Wiki :)