okey so what i want to do is kick people when they die 5 times or more, i already tried adding things to my leaderboard script but nothing happens (when i die 5 times i dont get kick)
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
if deaths.Value >= 5 then -- here nothing happens
Player:Kick("You have died too many times!")
end
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)
thats my script

1 comment
It's not working, because you're not repeatedly checking the value of the deaths. This is just running once and stops. The CharacterAdded event will run everytime the player respawns/dies.