Can't develop script for cash per kill

I wanted to create cash per kill but for some reason I encounter an error (shown below)
I worked with the following script:

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

local cash = Instance.new("NumberValue")
cash.Name = "Cash"
cash.Parent = leaderstats

player.CharacterAdded:Connect(function(Chr)
    Chr.Humanoid.Died:Connect(function(Died)
        local creator = Chr.Humanoid:FindFirstChild("creator")
        local leaderstats = creator.Value:FindFirstChild("leaderstats")
        if creator ~= nil and creator.Value ~= nil then
            leaderstats.Cash.Value = leaderstats.Cash.Value + 10
        end
    end)
end)

end)

There is an error "Attempt to index nil with “Value”

Who knows what to do?

Could you go more in depth of what creator is? Is it an ObjectValue pointing to a Player?

1 Like

I’m sorry, this issue is all closed, the decision was to create a tag on the tool, I’m sorry that I demanded.

If it’s the creator tag found in various old Roblox gears/BrickBattle tools then it’s an ObjectValue which points to the player’s character’s humanoid instance.

1 Like