So, I was just trying to make a kill for money script for my game, I keep on encountering errors whenever I try using the code that I provided.
Here is the code I used
game.Players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency1 = Instance.new("IntValue",folder)
currency1.name = "Cash"
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local stats = tag.Value:WaitForChild("leaderstats")
stats["Cash"].Value = stats["Cash"].Value + 10
end
end
end)
end)
end)
Whenever I try killing an NPC or person, it just doesn't work. Can someone please help me?

5 comments
You didn’t capitalize “Name” on line 5. Also I recommend you use :Connect and not :connect as I heard it was deprecated.
Denny is correct. It would also help if you could put down what errors the script is encountering. That'd help us resolve the problem.
I tried the script and it works fine as long as you correct what Denny said. Other than that it must be your sword/gun/whatever you have that isn't creating a tag.
Thanks Denny9876!
No problem! :D