Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a color changing brick?

Asked by 6 years ago
1game.Workspace.tile.Color = Color3.fromRGB(255,0,0)
2 
3wait(1)
4 
5game.Workspace.tile.Color = Color3.fromRGB(0,255,0)
6 
7wait(1)
8 
9game.Workspace.tile.Color = Color3.fromRGB(0,0,255)

How can I make this a loop?

1 answer

Log in to vote
0
Answered by
Rheines 661 Moderation Voter
6 years ago
Edited 6 years ago

To change the color of a BasePart, you need to set its BrickColorusing the BrickColor.new() constructor or its Color using the Color3.new() constructor.

To make the color loop, all you need to do is to make a while true do loop, which will repeat indefinitely.

You also can put tile into a variable so you don't need to repeat yourself too many times.

01local tile = workspace.tile
02 
03while true do
04    tile.BrickColor = BrickColor.new(255,0,0)
05    wait(1)
06    tile.BrickColor = BrickColor.new(0,255,0)
07    wait(1)
08    tile.BrickColor = BrickColor.new(0,0,255)
09    wait(1)
10end
0
Thanks Xanfar38 -3 — 6y
Ad

Answer this question