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
 

How would I use Math.Random here?

Previous Thread :: Next Thread 
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
04 Jul 2015 08:53 PM
while true do
P = 0
for i, s in pairs(dance_floor:GetChildren()) do
if (s.ClassName == "Frame") then
local originalcolor = s.BackgroundColor3
local newcolor = color3(0,0,0)
for i = 0,1,0.02 do
s.BackgroundColor3 = tween_color(originalcolor,newcolor,i)
s.BackgroundTransparency = 1/(1/i)
run.RenderStepped:wait()
end
s.BackgroundColor3 = color3(0,0,0)
s.BackgroundTransparency = 1
--s.BackgroundColor = BrickColor.Random()
end
end
run.RenderStepped:wait()
end

It's a surface GUI, and I want it to randomly pick colors and flash them/change their colors.
Report Abuse
Veltamax is not online. Veltamax
Joined: 06 May 2012
Total Posts: 368
04 Jul 2015 08:57 PM
Maybe you could try doing:

Color3.new(math.random(0,255), math.random(0,255), math.random(0,255)

if that doesn't work, I don't know if this works or not, but you could try using that commented section there with the BrickColor.Random(), and put s.BackgroundColor = BrickColor.Random().Color
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
04 Jul 2015 09:02 PM
I mean randomly pick the frames, because it goes in order right now.
Report Abuse
Veltamax is not online. Veltamax
Joined: 06 May 2012
Total Posts: 368
04 Jul 2015 09:11 PM
Try something like this:

local frames = {}

for i,v in pairs (SURFACEGUI:GetChildren()) do
if v.Name == "Frame" then --determining if it is a frame, change to needs
table.insert(frames, v)
end
end

local pickedframe = frames[math.random(1,#frames)]
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
04 Jul 2015 09:21 PM
local s=SURFACEGUI:GetChildren()

local rand=s[math.random(1,#s)]
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