So I created a game loop, and at the start of the loop, I got all the player objects and put them inside an array. When doing stuff to the player, like teleporting, assigning they’re team, when they leave the game, the player object in the array corresponding to the player leaving turns into nil. However, I have a simple if check making sure that when I try to assign a team to a player who is now nil as they have left the game, it removes them from the table, like this:
However, I get this stupid error:
Edit: This error also happens to other parts of my script where it check if its nil, but it doesn’t pick up for some reason, and it still tries to edit the player object even tho it is nil and doesn’t remove it, even tho the if statement clearly checks if the player object is nil.