So I have this block of code that checks if the humanoid has died. If they have died, it sets their values to false and subtracts 1 from the playingPlayers value
for i, v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Humanoid") then
local hum = v.Character:FindFirstChild("Humanoid")
hum.Died:connect(function()
v.fakestats:WaitForChild("IsAlive").Value = false
v.fakestats:WaitForChild("InGame").Value = false
playingPlayers = playingPlayers - 1 -- Right here, let's say theres 3 playingPlayers. Instead of going to
--2, it goes way down to like -35 or something.
end)
end
end
My issue: Let's say playingPlayers is at 3. Then someone dies. The script runs through and does everything correctly.. but instead of going from 3 to 2, it subtracts like 30 and goes down to -34 or something. Why does it do this? Why doesn't it just subtract ONE from the variable? Please help!

2 comments
Where is the script localted? Does it re-apear in the player everytime they respawn? If so, you could do a while wait() do loop and check to see if their health is 0. if it is then num = num - 1 break end Let me know and I'll write you a code if you're confused.
This block of code is in a for loop which counts down the time of the minigame, because it is a minigames game. Every 1 second it is fired, basically if the same humanoid has died, since it checks every second, it keeps firing.