My error is Expected ‘then’ when parsing if statement, got ‘=’
When using = in if statements, make sure it’s ==, not just a single =. This will make the script think you’re trying to set a value in the if statement code line.
on line 2, conditional statements need “==” when comparing.
the “=” assigns values
the “==” checks a value
I did that, but then I get another error saying “attempt to index nil with ‘Visible’”. Any reason for this?
It seems like you’re using this weird _G thing, can I know what it is?
It’s just for global variables, so that I can use them in different scripts. I dont really think it should affect that but maybe it does i dont know
Double check your variable, you may be checking if the GUI object is visible and not the frame/textlabel/textbutton
Do not use it. I believe it’s deprecated. Just make a variable about that at the beginning of the script and refer it.
When using global variables, you have to be careful that they are properly initialized.
You may not know the order of execution of scripts so you’ll need to either always
require()
a ModuleScript
that initializes them, or if possible, in any given script that
uses them, first check if nil
, and if so, initialize them to something useful.