I have written a piece of code that is in two different scripts, one changes the variable and the other reads it.
script one
closed = game.Workspace.closePressed function closeGui() closed = false end
script two
closed = game.Workspace.closePressed if closed == true then ... end else if closed == false then end
I'm not sure what you're getting at here, as you have very little code provided, but there is a problem with script two, and that's that you have ended the if
statement before you introduced the elseif
.
Corrected code:
closed = game.Workspace.closePressed if closed == true then ... elseif closed == false then --there is no space in "elseif", that is another problem. ... end
Oh, Yeah that happens some times. btw the global function is _G