So The problem is
1 | Randomizer/ 3 = = math.floor(Randomizer) |
will never equal each other here is why
if Randomizer = 1 then
Randomizer/3 = 0.333
math.floor(Randomizer) = 1
if Randomizer = 2 then
Randomizer/3 = 0.6666
math.floor(Randomizer)=2
if Randomizer = 3 then
Randomizer/3 = 1
math.floor(Randomizer)=3
if Randomizer = 4 then
Randomizer/3 =1.33333
math.floor(Randomizer)=4
and so on
in the end you will never be able to get a blue person on the cops team or it will at least take a massive amount of players for only one blue the other problem would be that technically the teams would never be random as it goes in order so it would pick the same people for the same roles.
So the alternative that is random and will still make the same 1:3 ratio is something like this
01 | function randomizeTable(tbl) |
02 | math.randomseed(tick()) |
06 | table.insert(returntbl,math.random( 1 ,#returntbl+ 1 ),tbl [ i ] ) |
12 | local CopPrisonerRatio = 3 |
13 | local TotalPlayers = #(game:GetService( "Players" ):GetChildren()) |
17 | local numberOfCops = math.floor((TotalPlayers/(CopPrisonerRatio+ 1 )) + 0.5 ) |
19 | local playerList = randomizeTable(game:GetService( "Players" ):GetPlayers()) |
21 | for i,v in pairs (playerList ) do |
23 | if copsPicked<numberOfCops then |
24 | v.TeamColor = BrickColor.new( "Navy blue" ) |
26 | v.TeamColor = BrickColor.new( "Bright red" ) |
Its much longer than what you made but it will make sure the teams are randomized
and that both teams will random players.
If this does not work for you I am sorry and I will remove this post to prevent it from misleading others.