How would you divide all the players into by two to determine how many teams there will be?

Nice, also reffer to what i said earlier.

You’re making a very basic mistake, you have a localscript in the workspace, which won’t run.
(If you want to truly understand how roblox lua works, start from the basics)

Whoops, didn’t see that (30 chars)

Also, would you make more remote events for the other i % x parts as well? And if there were 4 people in the server for example, would it make 2 teams? I want to do for the number of players divided by 2.

Something like this

        ''''
                 if i % 5 == 0 then
              local team = Instance.new("Team", game.Teams)
              game.ReplicatedStorage.Teams:FireAllClients()
           end		
                  if i % 4 == 0 then
              local team = Instance.new("Team", game.Teams)
              game.ReplicatedStorage.Teams:FireAllClients()
                  return
           end		

                      -- so on...
              '''
local num_of_teams = #game.Players:GetChildren() / 2

for k, v in pairs(RandomOrderTable) do
 for i = num_of_teams, 0, -1 do
  if k % i == 0 then
   --assigns to team #i
   break
  end
 end
end

This is the closest thing i can think of doing for what you need to do, It may not be exact.

So it keeps assigning teams until no more teams can be made? And also, do I delete that other script you posted, or part of it. If so which part do I delete?

and then where you put the comment, do you fire a remote event and then on a local script assign the players a team?

You don’t fire a remote event. its just more complex and it won’t even work (FilteringEnabled)

Would @AdaptabiI script divide all the players by two, and determine the amount of teams?

Have you tried my script…?
30 characters

Where in the script would you put the code? Do I remove the other piece of code you shared, or just part of it?

Also, I have not tried your script because I don’t know the parts of the script I need to delete…

Sorry I’m bumping the topic, but it has been 5 days since the last reply, and I really need help on this…

…You were given the answer

Just use the code i sent you. and keep the randomordertable.

2 Likes