Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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 comment

1

It is better to use the '.Died' event upon a Humanoid's Death.

2 answers

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

This discussion is preserved as it was. New answers, comments, and votes are closed.