Hello! So I'm having an issue with this npc cash for kill script. It is placed inside my npc (Zombie) and after a player kills it, they receive 10 cash. However, it stops rewarding the player cash after the first "10 cash". I have tried dozens of different cash scripts and tutorials, but so far this is the only script that even partly works. If someone could give insight with an example script that would be much appreciated given that I am very new to scripting.
01 game.Players.PlayerAdded:Connect(function(player) 02 local Zombie = script.Parent -- npc model 03 local Humanoid = Zombie.Humanoid -- humanoid inside the model 04 local Cash = player.leaderstats.Cash -- the money 05 local CashReward = 10 -- amount of money I want to give when npc dies 06 Humanoid:GetPropertyChangedSignal("Health"):Connect(function() 07 if Humanoid.Health == 0 then 08 Cash.Value = Cash.Value + CashReward 09 end 10 end) 11 end)