Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My gui wont appear based off the value?

Asked by
h5148 -93
5 years ago
Edited 5 years ago

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

0
remove the elseif and replace it with else Frame.Visible = false Gameplayer365247v2 1055 — 5y
0
what does it print? SurfedZ 36 — 5y
0
u need elseif lowercase E and after that Value == 2 or 1 or 0 then greatneil80 2647 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

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:

  • Equal to a == b. If a is the same as b, then do something.
  • Not equal to 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 =.

0
This answer should be easier to understand. DeceptiveCaster 3761 — 5y
0
i'll just accept ur answer since mezorno makes no sense User#24403 69 — 5y
0
lol really DeceptiveCaster 3761 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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.

0
Im confused h5148 -93 — 5y
0
"The" comparative sign? There's more than one, you know. DeceptiveCaster 3761 — 5y

Answer this question