Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make a leaderboard with kick script?

Asked by 4 years ago

i want to do dis but idk how

when u die u get 1 death

if u get 5 deaths u get kick

also im ussing this script as leaderboard script

local Counter = "Deaths"

game.Players.PlayerAdded:connect(function(Player)
    local leaderstats = Player:FindFirstChild('leaderstats') or Instance.new("Folder", Player)
    leaderstats.Name = "leaderstats"

    local deaths = leaderstats:FindFirstChild(Counter) or Instance.new("IntValue", leaderstats)
    deaths.Name = Counter
    deaths.Value = 0

    Player.CharacterAdded:connect(function(Character)
        local d = true
        Character:WaitForChild("Humanoid").Died:connect(function()
            if (d) then
                d = false
                deaths.Value = deaths.Value + 1
            end
        end)
    end)
end)

help

1 answer

Log in to vote
0
Answered by 4 years ago

To kick try this:

if deaths.Value >= 5 then
    Player:Kick("You have died too many times!")
end
0
where im supposed to put that? densomenso999 11 — 4y
0
Try after the line "deaths.Value = deaths.Value + 1" IProgram_CPlusPlus 58 — 4y
0
it doesnt kicks me densomenso999 11 — 4y
Ad

Answer this question