Help figuring out how to make a currency system with leaderstats

I need help with figuring out how to do a script where every time someone kills another player they get xp and when they get xp they will level up.

Please help I’ve been trying to figure out how to do this for about a month and I’ve looked it up and it wont work.

You could just add a creatorTag check if the Player has a creator ObjectValue inside their Humanoid, then add the XP to their stats

A creatorTag is simply just a kill check when you want to confirm who killed who, its an ObjectValue that can hold an Object (Supposedly the Player’s object for easier use)

All you’re just really doing is adding a CharacterAdded event & detecting when a Character dies when you first set up your leaderstats

local AmountToGive = 50

game.Players.PlayerAdded:Connect(function(Player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = Player

    local XP = Instance.new("IntValue")
    XP.Name = "XP"
    XP.Parent = leaderstats

    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")

        Humanoid.Died:Connect(function()
            local CreatorCheck = Humanoid:FindFirstChild("creator") --Checking if a creator is in the Target
            if CreatorCheck and CreatorCheck.Value then
                local Killer = CreatorCheck.Value
                local stats = Killer:FindFirstChild("leaderstats")

                if stats then
                    stats.XP.Value += AmountToGive
                end
            end
        end)
    end)
end)