This works in studio but not ingame, an have no clue why?... it's supposed to be only clickable when my map is fully loaded, it works in studio just fine but ingame doesn't work?
function onButton1Down() print("Click") if _G.mapLoaded == false then print("Cannot Enter Current Game") end local Places = {Vector3.new(-109.146, 190.18, 107.483), Vector3.new(-96.086, 190.18, 34.753), Vector3.new(-133.056, 190.18, 37.913), Vector3.new(-109.146, 194.17, 73.933)} if _G.mapLoaded == true then print("Teleporting") game.Players.LocalPlayer.Character:MoveTo(Places[math.random(1,#Places)]) script.Parent.Parent.Parent.Parent:remove() end end script.Parent.MouseButton1Click:connect(onButton1Down)
Global variables don't work in localscripts.