Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Studio, not ingame.?

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)

2 comments

0

Is this a Script or a LocalScript?

0

LocalScript

1 answer

Global variables don't work in localscripts.

1 comment

0

That is completely false...

This discussion is preserved as it was. New answers, comments, and votes are closed.