ModeString = {"Normal", "Colored"}
ModeValue = {_G.normal, _G.colored}
function PickMode()
local nextmode = math.random(#ModeString)
Talk("The gamemode is ".. ModeString[nextmode],2, "")
ModeValue[nextmode] = true
end
function ResetMode()
for i,v in pairs(ModeValue) do
v = false
end
end
This is a portion of a functioning script. These functions, however, aren't working entirely.
The non-functioning portion is where I try to set a global variable as true
ModeValue[nextmode] = true
The code works perfectly up until this line. It seems to skip this line without displaying an error in the output.
Also, ResetMode()obviously doesn't work; I used the same thought process as the line above.
Is there an error in this code, or is this simply not possible?

3 comments
Thanks for your help! Currently, I have a main script which controls the majority of what happens in the game. It indirectly controls another script by activating and deactivating it. This second script uses the Game Mode global variables to spawn things in a certain way for that specific gamemode. To answer the second part of your question, I don't know of a more controlled way. I don't even know
...what modules are for that matter. [Sorry, the comment got cut off]
This'll work, as you learn more you'll probably figure out a cleaner way to do it.