I have a preset code for a zombie to respawn when killed. To make a shop based on how many kills you have, I want to add 1 to the KOs value when the zombie dies. How should I do this. Sure, it should be right after "if health == 0 then" but what do I write?

P.S. I made a KOs and WOs section on my leaderboard.

z = script.Parent

backup = z:clone()

while true do
	wait(5)
	if z.Zombie.Health == 0 then
		z:Remove()
		wait(10)
		backup.Parent = game.Workspace
		backup.Head:MakeJoints()
		backup.Torso:MakeJoints()
	end
	if z == nil then
		wait(4)
		backup.Parent = game.Workspace
		backup.Head:MakeJoints()
		backup.Torso:MakeJoints()
	end
end 

2 comments

0

There is function for humanoid died. Learn more here: https://developer.roblox.com/en-us/api-reference/event/Humanoid/Died Hope this helps

0

Try health <=0