Npc Cash For Kill Script Only Rewarding First Time?
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 | 01 game.Players.PlayerAdded:Connect( function (player) |
02 | 02 local Zombie = script.Parent |
03 | 03 local Humanoid = Zombie.Humanoid |
04 | 04 local Cash = player.leaderstats.Cash |
05 | 05 local CashReward = 10 |
06 | 06 Humanoid:GetPropertyChangedSignal( "Health" ):Connect( function () |
07 | 07 if Humanoid.Health = = 0 then |
08 | 08 Cash.Value = Cash.Value + CashReward |