Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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?

2 comments

0

Please use the code block.

0

There, I used the code block

1 answer

✓ Accepted answer

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

4 comments

0

Thank you for your answer.

0

@Goulstem, you have a error on line 07.

0

@thecontinent, don't worry. I relize it.

0

Edited(:

This discussion is preserved as it was. New answers, comments, and votes are closed.