#How to fix my (kill npc for cash) script

1 messages · Page 1 of 1 (latest)

bleak glacier
#

It can't work when I using my own punch system to kill npc.
How to fix it?

script.Parent:WaitForChild("Humanoid").Died:Connect(function()
    local Humanoid = script.Parent:WaitForChild("Humanoid")
    local Tag = Humanoid:FindFirstChild("creator")
    
    if Tag and Tag.Value then
        local PlayerName = Tag.Value
        local killer = game:GetService("Players"):FindFirstChild(PlayerName.Name)
        killer.leaderstats.Cash.Value += 100
    end
end)