Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

Randomize Team

  • This website was created by Roblox members to replace the official forums (because Roblox shut them down) Join us if you like Roblox!

ElHomburgerGuy

If you won't let yourself fail, you won't improve
Reputation: 5 / 0 / 1
Apr 24, 2019
6,028
15
1,969
113
Anonymous in the USA
Roblox
PieroWasTaking
Discord
Piero#5261
Would use something like math.random with the teams you have in your Teams folder.


TeamRandomizer:
--Note: This script must be place in SeverScriptService

local Teams = game:GetService("Teams"):GetChildren()

game.Players.PlayerAdded:Connect(function(player) -- Runs when a player joins the game
    if player then
        if player.team == nil then
            local RandomTeam = Teams[math.random(1, #Teams)]
            
            player.team = RandomTeam
        end
    end
end)
 

programingsystem

New Member
Reputation: 0 / 0 / 0
Feb 16, 2021
10
0
1
Roblox
oscarzusty
Would use something like math.random with the teams you have in your Teams folder.


TeamRandomizer:
--Note: This script must be place in SeverScriptService

local Teams = game:GetService("Teams"):GetChildren()

game.Players.PlayerAdded:Connect(function(player) -- Runs when a player joins the game
    if player then
        if player.team == nil then
            local RandomTeam = Teams[math.random(1, #Teams)]
           
            player.team = RandomTeam
        end
    end
end)
This is good idea but i must random team after start round but i use this script thx
 

ElHomburgerGuy

If you won't let yourself fail, you won't improve
Reputation: 5 / 0 / 1
Apr 24, 2019
6,028
15
1,969
113
Anonymous in the USA
Roblox
PieroWasTaking
Discord
Piero#5261
Would use something like math.random with the teams you have in your Teams folder.


TeamRandomizer:
--Note: This script must be place in SeverScriptService

local Teams = game:GetService("Teams"):GetChildren()

game.Players.PlayerAdded:Connect(function(player) -- Runs when a player joins the game
    if player then
        if player.team == nil then
            local RandomTeam = Teams[math.random(1, #Teams)]
          
            player.team = RandomTeam
        end
    end
end)
This is good idea but i must random team after start round but i use this script thx
You can then use the same function whenever a certain time hits or round starts. ;)