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

How can I fix this color-changing script to make it what I want it to be?

Asked by 9 years ago

I am trying to make a script that changes an object's color from red to blue to purple to pink to orange and then repeating this cycle. Here is my first script I tried:

game.Workspace.part = changer
changer.BrickColor = "Red"
changer.BrickColor = "Blue"
changer.BrickColor = "Purple"
changer.BrickColor = "Pink
changer.BrickColor = "Orange"

Results: This script doesn't loop the color changer and doesn't even show colors. I wanted it to loop the colors and show the colors.

What can I add to fix this script to make sure it is what I want?

0
Please use the code block. woodengop 1134 — 9y
0
There, I used the code block toyotaghost 10 — 9y

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Your Problem

The BrickColor Property takes BrickColor values. And you're supplying strings.

Also, you're trying to set a variable on line 1, but you're doing it backwards(:


How To Fix

So you need to put the strings inside BrickColor.new functions.

And you also want it to loop constantly? To do this you need to put your code in a while loop.


Code

local changer = workspace.part

while wait() do
    changer.BrickColor = BrickColor.new("Red")
    changer.BrickColor = BrickColor.new("Blue")
    changer.BrickColor = BrickColor.new("Purple")
    changer.BrickColor = BrickColor.new("Pink")
    changer.BrickColor = BrickColor.new("Orange")
end
0
Thank you for your answer. toyotaghost 10 — 9y
0
@Goulstem, you have a error on line 07. woodengop 1134 — 9y
0
@thecontinent, don't worry. I relize it. toyotaghost 10 — 9y
0
Edited(: Goulstem 8144 — 9y
Ad

Answer this question