Matchmaking problem

Hello. i am having an issue with my matchmaking system. sometimes there is 1 player left but it wont start new game and declare the winner.
i have tried altering the script but it didnt work.

while task.wait(1) do
	
	print(#script.PLAYER_FOLDER.Value.IN_BATTLE:GetChildren())
	if #script.PLAYER_FOLDER.Value.IN_BATTLE:GetChildren() == 1 then

		local People = script.PLAYER_FOLDER.Value.IN_BATTLE:GetChildren()
		local Winner = People[1]
		AnnounceWinner(Winner.Name.." WINS!")

		NewGame()

		elseif #script.PLAYER_FOLDER.Value.IN_BATTLE:GetChildren() == 0 then

NewGame()

else
	end
end




1 Like

Does it still print the getChildren() print? And can we see your folder path? Also optimization-wise, I would swap the while task.wait(1) to be a [folder path].changed connect event fire

i found the issue, the issue was people being fling into the spawn back

anyways now i have new issue of animations not playing without throwing any error

You should make a new post for that. Glad to know it was a simple fix-- the if statement logic looked fine to me lol