I can never figure this out, could anybody help me out here?
✓ ANSWER ACCEPTED
How would I make a player teleport to another game when a GUI is clicked?
2 answers
✓ Accepted answer
Hmm, Try this (Place inside the TextButton);
repeat wait(0)until game.Players.LocalPlayer and game.Players.LocalPlayer:FindFirstChild("PlayerGui") -- Repeats waiting 0 seconds until LocalPlayer, and LocalPlayer's PlayerGui
local PlaceId = 000000 --Replace the 0's with the place ID you want the player to teleport two when player clicks on it
script.Parent.MouseButton1Down:connect(function() --When LocalPlayer clicks on the Gui
game:GetService("TeleportService"):Teleport(PlaceId, game.Players.LocalPlayer) --Teleports the LocalPlayer to the desired place
end) --The end) for the MouseButton1Down event
Hope this helped!
local MyPlaceId = 0
local IWANNATELENOW = game:GetService("TeleportService")
local player = game.Players.LocalPlayer
function IGOTABUCKETLOADOFCHEESE()
IWANNATELENOW:Teleport(MyPlaceId, player)
end
script.Parent.MouseButton1Click:connect(IGOTABUCKETLOADOFCHEESE)
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
I already have a textButton. Mind editing it to work with that?
Oh, sure.
There, that should do it!
Thank you!
No problem. ;)