I am trying to change the Value of a Boolean Value.
For some reason I am getting an error. Below is the Script and the Error message I am getting. I also sent a picture to prove that there is a bool value with the same name, in said character.
Ive tried changing the name, even changing what script it is in.
The script I am showing is in a Normal Script, after a remote event is called. I also have tried running it in a Local Script, neither worked.
I am not a scripter, but I know very basic stuff, any ideas on why this wouldn’t be working
I don’t see why it wouldn’t find the BoolValue, but I do see some other issues. (As long as it has been given time to load in before code execution)
1) Missing .Value
A BoolValue is a Value object, to access what information they are storing you need to write .Value.
2) Not using :FindFirstChild()
Not using :FindFirstChild() will cause an error if the boolean is not found. This can be fine in some cases, but it is often preferable to get a warning rather than an error.
3) bool == true
When comparing booleans you must never check if the boolean == true or == false. The result of == will always be true/false, which is what your boolean already contains. Therefore you may instead write if boolean then instead of boolean == true and if not boolean then instead of boolean == false.