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

Why does the else work, but the if doesn't?

Hi, I'm very new to this, and I'm having a hard time understanding why my code isn't working.

score = 500

if score > 100 then
	Script.Parent.BrickColor = BrickColor.new("Really red")

else	
	script.Parent.BrickColor = BrickColor.new("Really blue")
end

If the variable 'score' is less than 100 the brick changes to the color 'Really blue' as expected. It's only when I make 'score' above 100, (like in the above example), where the brick color remains unchanged? Why is this?

1 answer

✓ Accepted answer

You capitalized the "script" in line 4, it should look like this

score = 500

if score > 100 then
    script.Parent.BrickColor = BrickColor.new("Really red")

else    
    script.Parent.BrickColor = BrickColor.new("Really blue")
end

6 comments

0

Thank you, and sorry for wasting your time with a stupid mistake!

0

Everybody makes mistakes, it's part of the learning process!

0

Do I mark this post as answered and give reputation by doing so? How do I do that?

0

If a post correctly answered your question, then go to the bottom of the answer and find the button "accept answer", and click on that

0

I can't find the accept answer button :/

0

It's all good, I have plenty reputation so I don't really need any more of it

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