Table.remove is removing from 2 tables?

I have two tables. Both are just normal tables. Both contain 1 player instance (the same one).

Team = {
 Players = {}
}

Party = {
 Players = {}
}

So basically I print both tables, before removing the player from the Team table. Both print out that I have a player (same player) in each table. When I remove the player from Team, and print both tables again the player some how got out of the party table too? I don’t know what is happening??

for i = 1,#Team.Players do
	if Team.Players[i] == player then
		table.remove(Team.Players, i)
		break
	end
end

Are you sure that is the exact code? Because I feel like you did

Party = {
 Players = Team.Players
}

or something along those lines, which would cause there to be 2 references to the same table, therefore logically that would happen.

That wasn’t why. It was because somewhere in my 1000 lines of code I put Team.Players = Party.Players because like I wanted all the players in the Party table to go into the team table, and somehow the tables got like connected so whenever I changed something with Team.Players, party.Players also changed.

After looking for a hour and a half I posted this then I was like okay, I will go make a sub and then it randomly came to me.

That was why. Only the other way around. But glad you got it fixed.

Well originally it was set to just {}, but now I see your point and that did answer it thank you