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
 

Script not working

Previous Thread :: Next Thread 
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
19 Nov 2012 05:09 PM
b = game.Workspace.Jumps.RotatedBrick
for i = 1, 86 do
wait()
b.Color = Color3.new(math.random(),math.random(),math.random())
end

When the game runs, the script is supposed to go into the workspace into a model and recolor 86 different bricks (all with the same names).

Am I not being specific enough with my code, or is there something my script lacks..?
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
19 Nov 2012 05:12 PM
Also, if I lack of anything in this script, will someone explain what it is and why it's needed if it isn't too much? Thank you.
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
19 Nov 2012 05:29 PM
b.BrickColor = BrickColor.new(math.random(), math.random(), math.random())
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
19 Nov 2012 05:29 PM
Bricks dont use color3
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
19 Nov 2012 05:48 PM
Thanks, but I forgot to mention that it only colors one brick 86 times..
Do I rename them all..?
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
19 Nov 2012 05:52 PM
No, put the things in a model then do this..

while Wait() do -- you can remove this, this makes it repeat color change..
bricks = game.Workspace.Model:GetChildren()
for i=1,#bricks do
if bricks[i].ClassName == "Part" then
bricks.BrickColor = BrickColor.new(math.random(), math.random(), math.random())
end
end
end
end
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
20 Nov 2012 01:24 AM
Is the third line basically saying 'for __ number of bricks in 'model', run the script the same number of times' ? (By the way, sorry for a late reply, had homework.)
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:55 AM
for i = 1, #bricks do


i is just a variable...


#bricks is the number.

This would print the number of bricks:


p = game.Workspace:GetChildren()

print(#p)

A more advanced way is:

bricks = {}

for _, v in pairs(game.Workspace:GetChildren()) do
table.insert(bricks, v)
end

print(#bricks)

That would also print the number.


~A3~
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