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

What's the problem with this script?

I'm a new scripter, so don't judge.

if NumPlayers = 5 then
	print "hello"
else
	print "goodbye"
end

What's the problem?

2 answers

When checking the value of something, you must use two equal signs (==). One equal sign (=) is used to set a variable. Example:

local variable = 5
if variable == 5 then
print"Variable is indeed 5!"
end

See how I used one equal sign to set "variable?" If you have any further questions, please coment.

EDIT: There's a space between the "print" command and the quotes. Look at the code I posted, and note how the quote that I want to appear in the output is right next to the print command.

I have changed it to this.

if game.Players.NumPlayers == 5 then
	print "hello"
else
	print "goodbye"
end

Yet, this is the output.

12:52:24.865 - No active sound driver detected

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