Need help with debugging a few lines. Thread seems to pause with no error?

local Player = Game.isPlayer(Humanoid)
if Player then
	Game.log(area,"Out humanoid is a player, setting stats")
	DataStore2("GamesPlayed",Player):Increment(1,0)
	Player:LoadCharacter()
	Game.log(area,"Respawned and updated")
elseif Humanoid.Parent then --Check that the humanoid still exists
	Humanoid.Parent:Destroy()
end

The following code above adds “Out humanoid is a player, setting stats” to the debug table but somehow between that point and the next one “Respawned and updated” the thread seems to yield for infinity or something?

The function that this is a part of is wrapped in a pcall, and the pcall does not return anything. No success, no errors. Any ideas?

Here is a picture of the last log for that areaimage

Is this maybe related to LoadCharacter() killing threads as seen here?

What is in your Game.log thing? It’s probably yielding there

It just adds text to a table. I know that isn’t an issue because the only reason I even made a Game.log() was to try and find out why the games randomly stopped.

Hmm, try seeing what happens if you comment out that LoadCharacter line since you said it kills threads from the post you sent

Thats another problem… I am unable to recreate this issue. I only randomly find it in live games.

So it’s random and doesn’t happen consistently?

My game has 2 areas, lets call them area 1 and area 2. I have only see this bug occur in area 2 which is very confusing, considering they are 2 areas that run on exactly the same functions.

So it only happens in a specific area? And they’re both exactly the same code wise? If so, I’m actualyl stumped

for _,Arena in pairs(workspace.Arenas:GetChildren()) do
	spawn(function()Game.registerArea(Arena)end)
end

Yes, exactly the same. I remember having this exact problem with this game (before I rewrote it) and I do not remember what the solution was.

Also I just found a server where Area 1 is dead.

This is extremely odd, I can’t tell if this a bug with LoadCharacter since that looks to be what’s causing it

Yeah like I said earlier, I HAVE had an issue with LoadCharacter() killing threads in the past. I added a pcall loop to the main thread so hopefully if the area thread dies again it’ll show the error and just re-run the function.

Its official, its not an error. The thread is literally yielding to infinity.

If anyone is curious, I fixed this but spawning LoadCharacter() in a new thread. No idea why LoadCharacter() is causing infinite yeilds.