local i = script.Parent local map = workspace.Stadium.sa local gui = script.Parent.Parent.Parent local tele1 = game.Lighting.Tele1 function onButtonClicked() local plr = game.Players.LocalPlayer local character = plr.Character if (plr and character ~= nil) then character:MoveTo(map.Position) tele1:Clone().Parent = plr.PlayerGui script.Parent.Parent.Parent:Destroy() end end i.MouseButton1Down:connect(onButtonClicked)
I've re wrote it countless times, I browsed the wiki, This is my last resort! Thanks for any help.
repeat wait() until game.Players.LocalPlayer local i = script.Parent local map = workspace.Stadium.sa local gui = script.Parent.Parent.Parent local tele1 = game.Lighting.Tele1 function onButtonClicked() local plr = game.Players.LocalPlayer local character = plr.Character if (plr and character ~= nil) then character:MoveTo(map.Position) tele1:Clone().Parent = plr.PlayerGui script.Parent.Parent.Parent:Destroy() end end i.MouseButton1Down:connect(onButtonClicked)
The difference between studio and in game mode is that in studio, the player loads immediately. In game, the player takes a little bit to load. So, if we keep waiting until the script detects a Player, this can be resolved.
Is it in a local script?