when I run the script, it didn't work. The output said the "=" was an error
if Humanoid.Health = 50 then
Head.BrickColor = BrickColor.new("Really red")
end
when I run the script, it didn't work. The output said the "=" was an error
if Humanoid.Health = 50 then
Head.BrickColor = BrickColor.new("Really red")
end
If statements make comparisons while the "=" sign is used to assign values. Instead you need to use the relational operator "==" which basically just means is equal to. It's also important to understand that the "==" operator compares two parameters and returns a boolean. So the correct code would be...
if Humanoid.Health == 50 then
Head.BrickColor = BrickColor.new("Really red")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Essentially, use "==" when reading values, and use "=" when changing them.