0

# Value is not updating?

So basically what I wanted to happen was when this "Zombie"'s health is to 0, the zombie will update a set score of how many zombies have been killed, but it wont update :/ ?

wait(5)
if script.Parent.Zombie.Health ~= 0 then
game.Workspace.ZombieKill.Value = game.Workspace.ZombeKill.Value + 1

script.Parent:remove()
end

1
It is better to use the '.Died' event upon a Humanoid's Death. TheeDeathCaster 2368 — 7y

0

Well for one you need to use a Loop so that is keeps checking, unless this is a bit of the script

while true do
wait(1)
if script.Parent.Zombie.Health == 0 then
game.Workspace.ZombieKill.Value = game.Workspace.ZombeKill.Value + 1
break
end
end


Try this and ~= 0 so then you're telling it to see if heath is NOT 0 so it won't fire OnDeath I recomend using the OnDeath

wiki.roblox.com/index.php?title=API:Class/Humanoid/Died