✓ Accepted answer
You need to remove the element from the table after you've selected it. Take this analogy as an example; you've entered a lottery, but when you win your name doesn't get removed, the paper note with your name written on it gets thrown back into the hat again. That means you still have a chance of winning again.
table.remove(table, index) will do the job for you. It'll remove the element you want gone and it will push the other elements forwards so there won't be a gap. It'll still work with ipairs.
Teamfolder[index] = nil will also remove the element, but it'll leave a gap in the table, and will now not work with ipairs.
But since you're not using ipairs here, either should do the trick for you.
local Teamfolder = {workspace.Team1, workspace.Team2, workspace.Team3, workspace.Team4}
local nan = 0
repeat
local index = math.random(1,#Teamfolder)
currentteam = Teamfolder[index]
print(currentteam.Name.." was chosen for this round.")
currentteam.Parent = game.Teams
table.remove(Teamfolder, index)
wait(1)
nan = nan+1
until nan == 5
3 comments
Oh. So that's what she/he tried to do! Great answer!
,
Thank you very much! Great answer!