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

GUI script wont teleport people to a different place when clicked?

Asked by 6 years ago

I would like it so that someone click's a start GUI in a main menu place and it loads then gives a hint that says loading then teleports them to the actual place but that doesn't seem to be working. The problem seems to be the script, the GUI is a textbutton. (BTW Im a beginner at scripting)

script.Parent.MouseButton1Click:connect(function()

local TeleportService = game:GetService("TeleportService")

local GameId = 880862623

local hint = Instance.new('Hint', workspace)
hint.Text = "Loading... Please allow up to 20 seconds :)"
wait(20)
hint:Destroy()

game.Players.PlayerAdded:connect(function(player)
    TeleportService:Teleport(GameId, player)
 end)
end)
1
Is it a LocalScript? Make sure it is. And remove the playerAdded function, there is no need for that. User#2146 0 — 6y
0
Remove the playerAdded function. Put it in a local script and I believe you need to get your moveTo function in there or else the script is not knowing where to place the player. AlwaysFris 0 — 6y
0
THANK YOU SO MUCH!! epicmariogameplayer 0 — 6y

Answer this question