i want all the players to die using their humanoids to reset them, and then i want to set all their teams to a team called ‘Neutral’
the issue:
i dont know how to set the team and im not good at for i,v in pairs (or just in pairs i think) which im pretty sure is needed to look for all the humanoids
-- // Variables //
local Players = game:GetService('Players') -- This is player service, it allows us to get players!
local Teams = game:GetService('Teams') -- This is the parent to all teams most of the time!
local TeamToSwapTo = Teams:FindFirstChild('YOUR_TEAM_HERE')
-- // Main Code //
for index:number,player:Player in pairs(Players:GetPlayers()) do -- this loops through the players, we use GetPlayers which uh, gets players
-- GetPlayers returns a table, an item in a table contains an index, or key, or you can think of it as a name, then it has a value, which could be anything
-- But we know that GetPlayers gives us a table of players, so the value is a player!
-- the index, or key comes first, then the value. So in this case, key comes first, then player.
-- now lets set some values!
player.Team = TeamToSwapTo -- Sets the team property of the player to the team of your chose!
end
I tried to leave some notes to help, if you have any questions feel free to ask!