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

How do I make a block change color repeatedly?

Asked by 4 years ago

Pretty much I am trying to make a block change from red to green and I want it to repeat but I also dont want this huge text script and I cant seem to make it repeat

while true do
    script.Parent.BrickColor = BrickColor.new ("Lime green")
    wait(4)
    script.Parent.BrickColor = BrickColor.new ("Really red")
    wait(4)
end

This is my script, I even tryed replacing the end with repeat and that did not work along with adding repeat before the end and it wouldn't work.

0
hold on i have done this before just need to test code it should be ready in like 10 minutes then ill anwser proplayer700 25 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

BrickColor.new() is meant to have Color Values as it's parameters, not strings. Therefore, the color parameters in RGB values would look something like this:

while true do
    script.Parent.BrickColor = BrickColor.new(0,255,0)
    wait(4)
    script.Parent.BrickColor = BrickColor.new(255,0,0)
    wait(4)
end

Feel free to try that out and accept if it works

0
Hmmm for RGB values you have to use Part.Color = Color3.fromRGB(164,168,50) proplayer700 25 — 4y
0
Yes, but we are using BrickColor CreationNation1 459 — 4y
Ad
Log in to vote
1
Answered by 4 years ago
local Part = script.Parent -- make sure your script is inside of the part you want to change colors

while true do
    Part.BrickColor = BrickColor.new ("Lime green")
    wait(1)
    Part.BrickColor = BrickColor.new ("Really red")
    wait(1)
end

this worked for me note: if you want to make it more then just 2 colors dont use Part.BrickColor = BrickColor.new ("Really red") with a whole bunch of wait() because that is really inefficient you can use a list and it will make your life a lot easier and if you use the list properly you wont even have to wait() multiple time

Keep scripting you'll get better :)

Log in to vote
0
Answered by 4 years ago

Thats weird, your script works for me!

Answer this question