I have written a piece of code that is in two different scripts, one changes the variable and the other reads it.
script one
1 | closed = game.Workspace.closePressed |
2 |
3 | function closeGui() |
4 |
5 | closed = false |
6 |
7 | end |
script two
1 | closed = game.Workspace.closePressed |
2 |
3 | if closed = = true then |
4 | ... |
5 |
6 | end |
7 | else if closed = = false then |
8 |
9 | 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:
1 | closed = game.Workspace.closePressed |
2 |
3 | if closed = = true then |
4 | ... |
5 | elseif closed = = false then --there is no space in "elseif", that is another problem. |
6 | ... |
7 | end |
Oh, Yeah that happens some times. btw the global function is _G