Hi! I want to know how to make a team assign command. For example, if I were to say “!teamassign” in the chat, it would assign certain ranks in my group to the corresponding teams.
I looked for other solutions but I was unable to find one that worked!
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
if msg == "!teamassign" then
for _, player in pairs(Players:GetPlayers()) do
local rank = player:GetRankInGroup() -- GROUP ID HERE
-- **Match each rank to a certain Team**
player.Team = team
end
end
end)
end)