I have been trying to remove the player from the table when the player dies it actually does work BUT it removes the other players from the table either.
Code:
game:GetService('Players').PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function(playerdied) print(player.Name .. " has died!") for i, player in pairs (game.Players:GetPlayers()) do warn(player, 'has Been Removed From Table - Intro Or AFK.') for i = 1, #queue1 do if queue1[1] == player then table.remove(queue1,i) end end end end) end) end)
A couple of things are wonky here. You are looping through each player in game.Players and each player your looping through is under the variable 'player'. This is fine, but take note that you're checking if queue1[1] == player on line8 (should be queue1[i]) and every player will eventually be player.
If your table contains the player instances in game.Players, keep looping through using this code, but make sure to change line 8 to queue1[i] and give the loop on line 5 a different name such as currentPlayer. It has the same name as the variable player on line 1 and the script can't tell them apart.