I’m trying to change all players teams to the “Playing” team through a script. I’ve tried doing research, but the results weren’t satisfactory.
Thanks
I’m trying to change all players teams to the “Playing” team through a script. I’ve tried doing research, but the results weren’t satisfactory.
Thanks
Yes, I tried researching. I’m learning to script, so I found it a bit confusing.
local teamsService = game:GetService("Teams")
local playersService = gaame:GetService("Players")
for _,p in ipairs(playersService:GetPlayers()) do
p.Team = teamsService.Playing
end
I suppose this is something you were looking for.
Go through the teams docs too.
Edit: typo in script
Thanks! That worked perfectly. Now I have a much better understanding of how this works.
Simply for the purpose of learning, would you mind explaining what this line is for:
for _,p in ipairs(playersService:GetPlayers()) do
This is basically a “for do” loop, except it uses the players as objects and constraints.