How to make an overhead kill counter

  1. What do you want to achieve?
    i want to make a kill counter for my billboard gui displaying the kill on the overhead when a player is killed and when the player dies it resets to 0 perhaps i’ve managed to make the script for leaderstats that works fine but i dont know how to implement that script to the overhead one

  2. What is the issue? Include screenshots / videos if possible!
    i dont know how to implement on the overhead of the player

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i have made the script successfully for leaderstats but i dont know how to implement on the overhead of the player

thats the overhead so basically i want the Textlabel.Text inside it to change to the number of kills

local DSS = game:GetService("DataStoreService"):GetDataStore("Kills")

game.Players.PlayerAdded:Connect(function(player)
    local key = player.UserId.."-Kills"

    local ls = Instance.new("Folder", player)
    ls.Name = "leaderstats"

    local Kills = Instance.new("NumberValue", ls)
    Kills.Name = "Kills"

    local data
    pcall(function()
        data = DSS:GetAsync(key)
    end)

    if data then
        Kills.Value = data[1]
    else
        Kills.Value = 0
    end

    player.CharacterAdded:Connect(function(char)
        char.Humanoid.Died:Connect(function()
            local creator = char.Humanoid:FindFirstChild("creator")
            if creator and creator.Value then
                local plrkilled = creator.Value
                local KillsValue = plrkilled.leaderstats.Kills
                KillsValue.Value = KillsValue.Value + 1
            end
        end)
    end)
end)

game.Players.PlayerRemoving:Connect(function(player)
    local key = player.UserId.."-Kills"
    DSS:SetAsync(key, {player.leaderstats.Kills.Value})
    DSS:RemoveAsync(key) -- Remove the player's data from the data store
end)

this is the script that that does exact the same on leaderstats but i dont know how to implement it for my billboard gui overhead , any help would be greatly appreciated

If you are adding Data to a DataStore, and then Deleting it when the Player leavess whats the point of having the DataStore.

All you are doing is checkng whether the Value jas Changed using .Changed, you would need to access the said and say Value.Changed, within the Event, tell it to change the Overhead UI.

1 Like

so basically its a kill streak so it needs to be deleted when the player dies too not just when he leaves the reason why deleting , can u be more specific with the code on how i change it to the overhead gui without any datastore