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

Studio, not ingame.?

Asked by 9 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?

01function onButton1Down()
02print("Click")
03if _G.mapLoaded == false then
04print("Cannot Enter Current Game")
05end
06 
07local 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)}
08 
09if _G.mapLoaded == true then
10print("Teleporting")
11game.Players.LocalPlayer.Character:MoveTo(Places[math.random(1,#Places)])
12script.Parent.Parent.Parent.Parent:remove()
13end
14end
15 
16script.Parent.MouseButton1Click:connect(onButton1Down)
0
Is this a Script or a LocalScript? Spongocardo 1991 — 9y
0
LocalScript AbsoluteZeroDEV 45 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

Global variables don't work in localscripts.

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

Answer this question