Intro to Scripting: Make a Dance Floor

From Goodblox Wiki
Jump to navigationJump to search


This is an Basic, Brick related tutorial.


Here's a very simple script that can liven up your place a little.

  1. Edit your place in GoodBlox Studio and select a brick of any color.



  2. Now select Insert-->Object from the menu bar.
    insert object appears then you select script.



  3. Type “Script” and click OK.
    The Explorer panel on the right-hand side of Studio will show a new “Script” object:



  4. Double-click the Script
    You will now see a script editor window
  5. Paste the following code into the script window
while true do
script.Parent.Color = Color3.new(math.random(), math.random(), math.random())
wait(0.5)
end


WARNING: The wait(0.5) line is very important. If you forget to put it in, your place will freeze up. No fun.

Close the script window. That’s it! If you upload your place and visit it, the brick will blink to a new color 2 times per second.




To make more bricks blink, repeat the following steps:

  1. Copy the Script object in the Explorer
  2. Right-click another brick
  3. Select "Paste Into" from the menu

The initial color that you choose for your bricks is unimportant; they will all change randomly and in different ways. Therefore, they can all be the same initial color, making it easier to set up the map.