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

How can I compare multiple variables?

I want to compare 3 variables to see if they have the same value as a 4th variable. I tried using the "and" operator.

if a and b and c == d then
	print("correct")
end

However, I found out that "and" can only be used between 2 variables. Is there an alternate operator that I can use?

Many thanks.

1 answer

✓ Accepted answer

You have to make sure you compare each variable with d individually

if a == d and b == d and c == d then
    print("correct")
end

Hope this helps!

2 comments

0

Thank you!

0

Glad I could help! For future reference, you can mark answers as accepted if they answer your question.

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