So i was trying to reset every player in my game so i went with a generic loop although it started crashing my game so i just let the loop print the players name if their character existed and it still crashed my game so can anyone give me some insight to why this is happening?
here is the code that crashes the game
function finish()
wait(5)
for j, k in pairs(game.Players:GetPlayers()) do
local c = k.Character
if c then
print (c)
c.Torso:BreakJoints() -- with or without it still crashes
wait()
end
end
survivorList = {}
infectedList = {}
wait(1)
serverCheck()
end

6 comments
Is there any code surrounding this, potentially code with a while, for, or repeat loop?
Where did you place it?
no this is the only loop that should be running it follows a repeat until but that hasnt crashed anything
this is placed in a function named finish only a wait(5) proceeds it in the method
Can you show more of the code? What you provided should not be crashing your game.
I noticed at the bottom it says serverCheck(). Could you show us what is in that function?