Kill for cash not working

Hey! Me and my friend tested my game and when someone kills someone, no one gets cash.

Here is the script

game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new(“Folder”)
folder.Name = “leaderstats”
folder.Parent = player

local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = 0
cash.Parent = folder

player.CharacterAdded:Connect(function(character)
	character.HumanoidDied:Connect(function()
		local tag = character.Humanoid:FindFirstChild("creator")
		if tag ~= nil then
			local player = tag.Value
			local bounty = 1

			local leaderstats = player:WaitForChild("Leaderstats")
			leaderstats.Cash.Value = leaderstats.Cash.Value + bounty
		end
	end)
end)

end)

Thank you,
Hunter

1 Like

What does it say in the output?

Leaderstats is uppercase, try writing leaderstats instead.

It still did not work for me…

It doesn’t say anything in the ouput.

Ah, another error in your writing.

Humanoid.Died:Connect(function()

3 Likes

“HumanoidDied” is not a valid event in the character, you have to use this instead: Humanoid | Roblox Creator Documentation

Also, make sure the “creator” value is set to in the first place.

3 Likes