So basically I’m making a round system for my game, and I want to make it so that if it’s a specific game mode it will remove the player from a table I created
if Chosengame == "Battle Tiles" or Chosengame == "Battle Doors" then
local others = {}
local finish = ChosenMap:WaitForChild("winpart")
finish.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local char = hit.Parent
local player = plrs:GetPlayerFromCharacter(char)
if player then
for i, plr in pairs(plrs:GetChildren()) do
if plr ~= player then
table.insert(others, plr)
end
end
end
for i, Player in pairs(others) do
if Player.Team == Playingteam then
Player.Team = Lobbyteam
--Here's the problem
for i, v in pairs(playing) do
if v == Player.Name then
print("we removing him")
table.remove(playing, i)
end
end
local character = Player.Character or Player.CharacterAdded:Wait()
local lobbyspawn = game.Workspace.lSpawns:GetChildren()
local randomlspawn = lobbyspawn[math.random(1, #lobbyspawn)]
character.HumanoidRootPart.CFrame = CFrame.new(randomlspawn.Position)
Player.Team = game:GetService("Teams"):WaitForChild("Lobby")
character:FindFirstChild("Tagged").Value = "nobody"
character.Humanoid.Health = character.Humanoid.MaxHealth
local toolstats = Player.ToolStats.Sword.Value
if Player.Backpack:FindFirstChild(toolstats) then
local plrsword = Player.Backpack:FindFirstChild(toolstats)
plrsword:Destroy()
elseif Player.Character:FindFirstChild(toolstats) then
local charsword = Player.Character:FindFirstChild(toolstats)
charsword:Destroy()
end
end
end
end
end)
For some reason it won’t loop through the part that I marked where the problem starts, I tried checking if it does the loop by putting a print statement, but it didn’t print it. I don’t know what the problem is and how to fix it as the output doesn’t show any errors