Hi I would like to make when I press a gui button its puts the player on a random team
1 Like
local Players = game:GetService("Players") -- The service for players
local Teams = game:GetService("Teams") -- The service for teams
Players.PlayerAdded:Connect(function(Player) -- On player join
local RandomTeam = Teams:GetChildren()[math.random(1,#Teams:GetChildren())] -- Gets a random team
Player.Team = RandomTeam -- Sets the random team
end)
This is how you would do this if you’d like a GUI you could just add the randomteam part as this is an example and devforum is for (Help) and not (Code)
3 Likes
If your too lazy to script you can just make random spawn points and random points that put you in a team.