So I want it to be where when I kill an npc, my gold goes up. It doesn’t work
My Script:
local humanoid = script.Parent.humanoid
function killforgold()
print("killed")
local tag = humanoid:FindFirstChild("creator")
if tag ~= nil then
print("success 1")
if tag.Value ~= nil then
print("success 2")
local leaderstats = tag.Value:FindFirstChild("leaderstats")
if leaderstats ~= nil then
print("success 3")
leaderstats.Gold.Value = leaderstats.Gold.Value +100
end
end
end
end
humanoid.Died:Connect(killforgold)
I put in prints to help me debug the problem
It doesn’t go past the “killed” print