Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Random players on team script?

I need help making a script that randomly selects 2 players from the game and puts them on a team. Honestly, I've tried making the script myself, but it never works. I don't even know how to make the script, honestly, I just tried what I thought would work. Can anyone help?

1 answer

local players= game.Players:GetChildren()
local team = game.Teams.Team1

local plr1 = players[math.random(1,#players)]
local plr2
repeat
plr2 = players[math.random(1,#players)]
until plr2 and plr2 ~= plr1

plr1.TeamColor = team.TeamColor
plr2.TeamColor = team.TeamColor

Un-tested, hopefully works

This discussion is preserved as it was. New answers, comments, and votes are closed.