Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My gui wont appear based off the value?

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

3 comments

0

remove the elseif and replace it with else Frame.Visible = false

0

what does it print?

0

u need elseif lowercase E and after that Value == 2 or 1 or 0 then

2 answers

✓ Accepted answer

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 =.

3 comments

0

This answer should be easier to understand.

0

i'll just accept ur answer since mezorno makes no sense

0

lol really

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.

2 comments

0

Im confused

0

"The" comparative sign? There's more than one, you know.

This discussion is preserved as it was. New answers, comments, and votes are closed.