As the title says, I want to know how to do a for loop, to get all the children of a team and do things like: load the player character, make a few frames visible, send remote messages to those players, also add the money ( I don’t want you to do all that to me NO) I just need to know how to get all the players of a team and that it can be useful
1 Like
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
if v.Team == your team then
--Player is in the team
end
end
1 Like
by chance I couldn’t send remote events with that for loop, because I need it to send remote events
Use a table, you can send those thru RemoteEvents. Make the loop add player names or IDs to the table.
Use Team:GetPlayers()
, it returns an array with all the players in a Team.
See more about :GetPlayers()
for i,v in pairs(YourTeam:GetPlayers()) do
-- script here
end