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

Studio, not ingame.?

Asked by 8 years ago

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)
0
Is this a Script or a LocalScript? Spongocardo 1991 — 8y
0
LocalScript AbsoluteZeroDEV 45 — 8y

1 answer

Log in to vote
-1
Answered by 8 years ago

Global variables don't work in localscripts.

0
That is completely false... drew1017 330 — 8y
Ad

Answer this question