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

0

Is there any code surrounding this, potentially code with a while, for, or repeat loop?

0

Where did you place it?

0

no this is the only loop that should be running it follows a repeat until but that hasnt crashed anything

0

this is placed in a function named finish only a wait(5) proceeds it in the method

2

Can you show more of the code? What you provided should not be crashing your game.

2

I noticed at the bottom it says serverCheck(). Could you show us what is in that function?