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

What's the problem with this script?

Asked by 9 years ago

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

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

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.

Ad
Log in to vote
0
Answered by 9 years ago

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

Answer this question