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

Why do I get an error message when I use '= 3'? Can someone explain why?

if game.Workspace.AmountOfOrbs.Value = 3 then
print("Hello")
end

--AmountOfOrbs is a string value btw--

1 comment

0

= is the assignment operator. You mean to use ==, the equality operator

1 answer

✓ Accepted answer

You're using a single equal sign =, which can be used to set variables but cannot be used to compare values.

You need an operator to compare values, a double equal sign == is what you're looking for.

if game.Workspace.AmountOfOrbs.Value == 3 then
print("Hello")
end

2 comments

0

that makes so much sense, thanks for your help

0

= is an operator

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