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 » Scripters
Home Search
 

Re: Selecting Random Things From Table

Previous Thread :: Next Thread 
DerpyMerpKing is not online. DerpyMerpKing
Joined: 05 Feb 2011
Total Posts: 2553
20 Sep 2015 11:31 AM
I'm a bit rusty, and forgot how to do it. I came up with this:
for i,v in pairs(game.Workspace.Pillar:GetChildren()) do
if v.Name == "Brick" then
local colors = {"Medium red", "Medium stone grey", "Dark stone grey"}
local thing = math.random(1,#colors:GetChildren())
local color = colors[thing]
v.BrickColor = BrickColor.new(color)
end
end



if siggy == false then print"nooo :(" end
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
20 Sep 2015 12:07 PM
would work


#code print("TreeBranch. Trader, Forumer, Developer".."R$4,068")
Report Abuse
Stymi is not online. Stymi
Joined: 19 Sep 2015
Total Posts: 1077
20 Sep 2015 12:09 PM
Hey!

This is much easier:

local color = colors[math.random(#colors)]

Also, you can't "GetChildren()" a table.
Report Abuse
DerpyMerpKing is not online. DerpyMerpKing
Joined: 05 Feb 2011
Total Posts: 2553
20 Sep 2015 12:11 PM
Thanks stymi!



if siggy == false then print"nooo :(" end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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