generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Team randomizer (request)

Previous Thread :: Next Thread 
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
05 Oct 2012 09:32 AM
I don't have a script to show, i want someone to give me some sort of team randomizer

example: If Part.Color=232 then (Randomize team script)

The teams should be even like 3v3.


You don't need to help me since i don't have a script. All i am here for is that i have no clue how to make a team randomizer. No clue at all.


Report Abuse
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
05 Oct 2012 09:32 AM
I would thank the one who does help me alot though :)
Report Abuse
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
05 Oct 2012 09:35 AM
What i mean with even teams is that there should'nt be a team with 2 more, 1 more could happend because if there is just 5/6 in the server. But if it's 6/6 and its 2 vs 4, i mean that can't happend.
Report Abuse
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
05 Oct 2012 10:12 AM
Bump
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
05 Oct 2012 11:13 AM
.-. It's easy. When atleast a certain ammount of people have joined, make a script to divide them evenly.
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
05 Oct 2012 12:21 PM
Well you could divide the amount of players on the server by two, and then use a loop to assin that amount of people to one team, and then find the ones that weren't sorted and put them on the secondary team you have,
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
05 Oct 2012 12:24 PM
like..:

plrs = game.Players:GetPlayers()

for i=1,(#players/2) do
--[[script for setting player team]]
end
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
05 Oct 2012 12:26 PM
@Dig,
for i = 1,#game.Players.NumPlayers/2 do
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
05 Oct 2012 12:27 PM
It's just a smaller version of what I said, but it would still work.. I think.
Report Abuse
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
05 Oct 2012 01:18 PM
I wonder one thing, what does 'for i' mean? Facepalm to you guys but i am such a bad scripter.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
05 Oct 2012 01:47 PM
@freekicking,

No, you're not bad at it, the others are. You're just a begginer, they're pretending they know but they don't.

I have some experience.

Alright...

for i = 1, 10 do
end

Let me explain that for you.

i is a variable, like in algebra.

For example, if I wrote

x = 1

Then anywhere in the script, x means one.

Using print, which is a function- a part of Lua which lets you "explain" things to the computer quickly, we can "say" what x is and it will come up in the output.

Script:

x = 1

print(x)

output:

1

Why did I put brackets after print and after x? Because print is a function, you should keep its arguments in brackets.

Woah, what? Arguments?

Arguments tell the computer what you want to do with the function. You separate them with commas (","s).

You can print with more than one argument like this:

print(x, x+1)

And you should see this in the output:

1
2

You can make variables with letters like this:

x = " hello "

(Notice that I separated hello with 2 speech marks- you can also separate with 's)

And you can print stuff without making variables like this:

print("hello", 213, "lol")

If you run that you will get this in output:

hello
213
lol

OK, back to fors.

for is a loop.

There are while loops, repeat loops, and custom loops you can create in ways.

"for i = 1, 10 do"

pretty much means

"inside my loop, i is how far I am in the loop, and I want it to start at 1 and end at 10"

Get it? Probably not.

"for x = 4, 13 do"

means

"inside my loop, x is how far I am in the loop, and I want it to start at 4 and end at 13."

also, you must put "end" where your loop ends.
the for loop doesn't end until its done, but when it does end, it will end when it sees "end"

So if you run this

for i = 1, 10 do
print("We are at ", i)
end

You should get this in output:

We are at 1
We are at 2
We are at 3
We are at 4
We are at 5
We are at 6
We are at 7
We are at 8
We are at 9
We are at 10

Get it? Maybe, maybe not.


I was going to make the team randomizer but... I'm out of time. "Go to bed!", my mum says.
Report Abuse
PsiStorm is not online. PsiStorm
Joined: 10 Jul 2012
Total Posts: 78
05 Oct 2012 03:58 PM
The post above is kind of confusing(at least for me).
What each part in the loop means
for i = 1,10,2 do

for --starts the loop
1,10,2 -- Iteration to start on, Iteration to end on, number iterations go up by(if there isnt a number it just goes up by one)
And iteration is simply how many times the loop has run
So "for i = 1,10 do" means that it will repeat the code in the for loop 10 times.

and i is simply a way to access what iteration you are on in the loop

for example

for i = 1,10 do
script.Parent.Transparency = i/10
wait()
end

so on the first iteration the output would be 0.1(product of i(or 1) divided by ten) then in the next iteration i would equal 2 so the output would be .2, this is faster and cleaner than typing script.Parent.Transparency 10 times
Report Abuse
FreeKicKing is not online. FreeKicKing
Joined: 12 May 2012
Total Posts: 6
06 Oct 2012 03:12 AM
Thank you guys.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image