Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I Make A Team Randomizer?

Asked by 6 years ago

I'm a Beginner Developer here and I want to know how I can randomly put players inside teams for my game. My Teams Are: Enforcers, Bombers, and Wittnesses. I will love it if anybody sends me answers.

0
It is already random AizakkuZ 226 — 6y
0
Make sure you check out the rules before you make a game like this. For what you're doing you can try out the random function http://wiki.roblox.com/index.php?title=Random and team changing http://wiki.roblox.com/index.php?title=API:Class/Player/Team Vulkarin 581 — 6y

2 answers

Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
6 years ago

@SinisterSinRobloxian Teams are random already with Spawns but if that's not what u mean you can make all of the spawn locations variables then make a script randomly pick them. Which depending on how many Spawn Locations you have I'm going to guess 3 from your listed ones.

It would look something like this

function getRandomSpawn() 
  local number = math.random(3)
  local suit = math.random(3)
  local spawn = ""
  if number >= 1 and number <= 3 then spawn = number + 1
   if suit == 1 then spawn = spawn .. "Enforcers"
  elseif suit == 2 then spawn = spawn .. "Bombers"
  elseif suit == 3 then spawn = spawn .. "Whittnesses"
  else card = "?" end

 spawn = spawn .. " of "

  else spawn = spawn .. "?" end

  return spawn

end

I'm really not familar with math.random so if this doesn't work then sorry but need anymore info use http://wiki.roblox.com/index.php/Random_numbers

0
Thank you for the great advice @Delsgamingchannel SinisterSinRobloxian 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

You should not be asking this question because Roblox randomizes teams by default. No need to ask, really.

Answer this question