I want to have a script find the value of a "Value" object. I tried if script.Parent.Parent.myvalue.Value = false then (My door function)
The script thinks that the "=" is supposed to be "then". Is there a way to make the code find the value of "myvalue" and make the door open under the condition that "myvalue" is a certain value?
✓ ANSWER ACCEPTED
How would I make a script do a function under the condition that a value is true and/or false?
1 answer
✓ Accepted answer
###The script threw that error, because the = operator is exclusively for assignments. When you want to use comparisons, you use the == operator, which checks equality. Your script should look like this:
if script.Parent.Parent.myvalue.Value == false then
--...
end
###But that can be made more efficient! It's true!
if not script.Parent.Parent.myvalue.Value then
--...
end
###Seeing you are new to the site, the most helpful answers to questions are to be accepted by clicking the 'Accept Answer' button. I'm not asking for you to accept my answer, if a better answer comes out, go ahead and accept that one instead.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks! That really helps!