local score = 0
function newcharacter(deadplayer, character)
score = score + 1
end
for _, player in pairs(game.Players:GetPlayers()) do
player.CharacterAdded:connect(function(character)
newcharacter(player, character)
end)
if player.Character and player.Character.Parent then
newcharacter(player, player.Character)
end
end
How can I get this to loop? I can't use a while true do loop, cause the 'newcharacter' adds +1 when called, and when I try it in a while true do loop instead of giving out +1 it gives out like +124358. I need this to loop, cause the script is disabled, and I turn the disable off when 2 players are on, but if 2 players are on and then a third joins it doesn't count that 3rd player.
Please help, is their like a debounce or something that could work?

2 comments
Not sure what you mean, what do you want to accomplish?
Well, like if their are two players in the game, then the script will actiavte, and if either of those 2 players dies, then it adds a point to score, but if a third player joins after the script has been activated and they die, nothing happens. Basically the for loop is only running once, and that's when it is activated, but I need it to continuously run, with using a while true do loop cause that