I have a script, and I want it to check that if the player is in the team test it will insert their name into a table and repeatedly kill them, there are no errors, it is in a regular script in ServerScriptService

local kill = {}

for _, v in pairs(game.Players:GetPlayers()) do
	if v.Team == "Test" then
		table.insert(kill, v.Name)
	end
end

game.Players.PlayerAdded:connect(function(player)
while true do
	 for _, v in pairs(kill) do   
        if player.Name == v then       
            coroutine.wrap(function()
               while true do               		              			
                   game:GetService("RunService").Heartbeat:wait()
                   if player.Character then                    		
                  		player.Character:BreakJoints()
                    else                    		
                    	player.CharacterAdded:wait()
                    end
                end	               
            end)()            
        end
	    end
	wait()
end
end)