Ad
Log in to vote
0

Killstreak board not showing?

Asked by 16 days ago

So there was a problem, for some whatever reason, the killstreak board wouldn't appear, The output also said there wasn't a problem

Script:

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

game.Players.PlayerAdded:Connect(function(player)

    local LS = Instance.new("Folder",player)
    LS.Name = "leaderstas"

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

    local key = player.UserId.."-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()
            Kills.Value = 0
            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))
end)

1 answer

Log in to vote
0
Answered by
boredlake 171
16 days ago

In line 6, you misspelled "leaderstats" to "leaderstas"

Ad

Answer this question