Please help. What's wrong with this script? It's suppose to make a gui appear when the Intvalue is at a certain value but It does not work. Please help me fix it!
local Frame = script.parent
Local Value = script.parent.IntValue.Value
If Value = 3 then
Frame.visible = true
Elseif Value = 2 or 1 or 0 then
Frame.visible = false
You're simply using the wrong symbol. One equal sign =
is meant to assign a variable to a value.
When comparing Instances, there are two comparison symbols you can use:
a == b
. If a is the same as b, then do something.a ~= b
. If a and b are not the same, do something.In your case, because you are seeing if something is the same as another thing, you should be using ==
instead of =
.
You're using the assignment variable when you should be comparing the values.
if i = 3 then
The above line of code reads as "if i equals 3 then complete this code"
What you really want it to say is "If i is equal to 3 then complete this code"
The code form of that would be the comparative sign ==
, this compares the values on either side and returns either true or false based on the outcome.