Team Checking isn't working (Need Help!)

For some reason, when i was making this script. It decided to break & i found the bug, it’s super confusing and im still wondering why its doing this.

for i, plr in pairs(game.Players:GetChildren()) do
			plr.Team = playingTeam- - the part where it actaully changes their team
if plr.Team == playingTeam then -- the part where it actaully breaks
					print("test3")
					table.insert(playing, plr.Name)
					print(#playing)
					
				else
					print("not working")

			end

could somebody help me? this bug would not allow me to contiune further with my development.

thanks!

Try this,

local playingTeam = {path}

for _, plr in pairs(game.Players:GetChildren()) do
    plr.Team = playingTeam

    if plr.Team == playingTeam then
        print("test3")
        table.insert(playing, plr.Name)
        print(#playing)
    else
        print("not working")
    end
end
	print("test")
			local playing = {}
			print("test1")
			for i, plr in pairs(game.Players:GetChildren()) do
				print("test2")
				
				if plr.Team == playingTeam then
					print("test3")
					table.insert(playing, plr.Name)
					print(#playing)
					
				else
					print("not working")

			end
		end

i already have a table ready

So what exactly are you trying to do with the team checker?

this is eariler of the script


	if started.Value == true then
		
		for i, plr in pairs(game.Players:GetChildren()) do
plr.Team = playingTeam
			local character = plr.Character
			local humanRoot = character:WaitForChild("HumanoidRootPart")
			

			humanRoot.CFrame = game.Workspace.spawn.CFrame
			
			
			character:WaitForChild("Humanoid").Died:Connect(function()
				plr.Team = lobby
				
				
			end)
			
		end	

Can you send the whole script so I can get a better understanding of what you’re trying to do?

i dont know but for my other game it works but for newer games it just breaks, honestly one of the reasons why roblox gives me tons of stress

Can you send the whole script, otherwise I am unable to help you.

About the whole script, my studio crashed. Now i’ve lost all of the scripting.

I’m fed up with roblox, it works with my other games but when i do it with this game it doesn’t work.