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
 

Re: Help?

Previous Thread :: Next Thread 
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
02 Nov 2014 07:01 PM
This script likes to choose 1 person as 2 "roles"
Is there a more efficent way of doing this?

local Players = game.Players:GetChildren()
local King = Players[math.random(1, #Players)]
local Guard1 = Players[math.random(1, #Players)]
local Guard2 = Players[math.random(1, #Players)]
local Assassain = Players[math.random(1, #Players)]
repeat
local King = Players[math.random(1, #Players)]
local Guard1 = Players[math.random(1, #Players)]
local Guard2 = Players[math.random(1, #Players)] local Assassain = Players[math.random(1, #Players)]
until Assassain.Name ~= Guard1.Name and Guard1.Name ~= Guard2.Name and King.Name ~= Guard1.Name and Guard2.Name ~= King.Name and Assassain.Name ~= King.Name
print(King.Name.." "..Guard1.Name.." "..Guard2.Name.." "..Assassain.Name.."")
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
02 Nov 2014 07:08 PM
bump
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
02 Nov 2014 10:14 PM
while wait() do
bump(Reply.Parent)
end
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
02 Nov 2014 10:42 PM
Function Bwamp()
while wait() do
Bump(Reply.Parent)
end
end

while wait() do
Bump(Reply.Parent)
Spawn(Bwamp)
end
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
03 Nov 2014 07:35 AM
t = Reply.Parent.Replies
repeat
wait()
Bump(Reply.Parent)
until Reply.Parent.Replies == t + 1
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
03 Nov 2014 07:46 AM
Yes actually, you need to start with a table of players, and then remove them from that table placing them into a "role" table and having leftover the non-role type players in the original table so as not to assign multiple roles to one player.
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
03 Nov 2014 08:37 AM
Example please?
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
03 Nov 2014 08:39 AM
Players=game.Players:getChildren()

king=Players[1,#Players]

table.remove(Players, king)

and so on like that, is the idea.
Report Abuse
drslicendice is not online. drslicendice
Joined: 05 Mar 2011
Total Posts: 18737
03 Nov 2014 08:40 AM
Oh, I get what your getting at. Thanks!
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
03 Nov 2014 08:45 AM
No problem

Good luck!
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