Ad
Log in to vote
0

Value is not updating?

Asked by 7 years ago

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

2 answers

Log in to vote
0
Answered by 7 years ago

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

Ad
Log in to vote
0
Answered by 7 years ago

Dude, you misspelled Zombie on line 4.

Answer this question