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: script doesn't work!

Previous Thread :: Next Thread 
Dane53719 is not online. Dane53719
Joined: 12 May 2009
Total Posts: 7
05 Dec 2011 09:03 PM
When I wrote this script in a brick it doesn't work! I want it to be like a dance floor. I expect random colors to be applied to the brick.

if true do

script.Parent.BrickColor = BrickColor.random()
wait(.5)

end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
05 Dec 2011 09:06 PM
while true do
wait(.5)
script.Parent.BrickColor = BrickColor.random()
end
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
05 Dec 2011 09:07 PM
You realize that script, if it was correct, would be just like saying:
script.Parent.BrickColor = BrickColor.random()

I'm suggesting you want a loop, soo.

while (wait(.5)) do
script.Parent.BrickColor = BrickColor.random()
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
05 Dec 2011 09:09 PM
@beauu

I think he was trying to put a loop...He just said if...
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
05 Dec 2011 09:11 PM
@miz
That's why I made a loop.
As far as I can see this forum has no common reading decency. =.=
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
05 Dec 2011 09:17 PM
colors = {"Bright red", "Navy blue", "Bright green", "Magenta", "Dark blue"}

while true do
script.Parent.BrickColor = BrickColor.new(colors[math.random(#colors)])
wait(0.5)
end
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
05 Dec 2011 09:30 PM
^

Easiler to just use BrickColor.random()
Report Abuse
TwoBoo is not online. TwoBoo
Joined: 08 Feb 2011
Total Posts: 10790
05 Dec 2011 09:36 PM
^
You'll get grey colors too if you use .random().
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
06 Dec 2011 03:11 PM
Twoboo

It's easier if you just say BrickColor.random() instead of writing all the colors of the table and using math.random..
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