For example, if the humanoid health's value is z, then something happens. This is my code: if health = 0 then this code doesn't work. How do I make this code work?
COMMUNITY QUESTION
How do you script the value of Humanoid Health?
2 answers
When your using conditional statements, only == is valid. You would most likely only use = if your changing the transparency or for ex: Thing.Transparency = Thing.Transparency - num.
This is the correct way to use the if statement with the humanoids health :
local p = game.Players.LocalPlayer
z = 0
if p.Character.Humanoid.Health == z then
print("humanoids health is at 0")
end
Try this.
local z = 0
if humanoid.Health == z then
-- code
end
You use == for equals to and = for assigning values.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Basically the same thing what i said, and you didn't defined humanoid
Sorry, didn't see it when I clicked on the page.
I didn't mena to approach you in a negative way. Just wanted to let you know what was wrong