Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Value is not updating?

Asked by 10 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 :/ ?

1wait(5)
2if script.Parent.Zombie.Health ~= 0 then
3game.Workspace.ZombieKill.Value = game.Workspace.ZombeKill.Value + 1
4 
5    script.Parent:remove()
6end
1
It is better to use the '.Died' event upon a Humanoid's Death. TheeDeathCaster 2368 — 10y

2 answers

Log in to vote
0
Answered by 10 years ago

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

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

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 10 years ago

Dude, you misspelled Zombie on line 4.

Answer this question