How can I cycle through a team

I am trying to make it so that when this part is touched it will cycle through a team and change a value inside every player on that team. I am pretty sure using a in pairs loop would be the most appropriate however I am extremely unexperienced with those so I would really appreciate some help.
This is pretty much all I have so far

local playersA = AwayTeam:GetPlayers()
playersA[1].Possession.Value = false
1 Like

With a for loop it would look something like this:

local playersA = AwayTeam:GetPlayers()

for _, player in pairs (PlayersA) do
    player.Possession.Value = false
end

https://education.roblox.com/en-us/resources/pairs-and-ipairs-intro

1 Like