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!