So I have a npc that you can kill and I put a server script inside it that makes it so when you kill the npc it gives you cash (this is a naruto game so cash = ryo). But the script doesn't give me money when I kill the npc, heres the script:
game.Players.PlayerAdded:Connect(function(player)
local Itachi = script.Parent -- npc model
local Humanoid = Itachi.Humanoid -- humanoid inside the model
local Ryo = player.leaderstats.Ryo -- the money
local RyoReward = 250000 -- amount of money I want to give when npc dies
if Humanoid.Health == 0 then -- I have tested this and if it is ">=" it gives cash when player joins the game, but I want it to only give cash if the npc dies
Ryo.Value = Ryo.Value + RyoReward
end
end)

1 comment
tysm! it worked, I have been trying to script something like this forever