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

Changing random colors not workin ? ;-;

while true do
script.Parent.BrickColor = BrickColor.new(math.random("Really red", "Bright blue"))
end

Why isnt it working ?

How do u do it correctly

2 comments

0

Couldn't you do BrickColor.Random()?

0

No, because the studio crashes

2 answers

✓ Accepted answer

#Problem:

BrickColor3 is not a thing on Roblox Studio. You would most of the time use Color3.new() with Guis. However, there are about 2 ways that I am aware you can do a random BrickColor for a Part. Also, your script also won't work 'cause you forgot to put a wait() inside of the infinite loop.

#Solution:

There are about 2 ways that I am aware of in which you can give a Part a random BrickColor.

###Here is the first one:

while wait() do
script.Parent.BrickColor = BrickColor.new(math.random(1, 100)) -- While BrickColor3.new() is not a thing on Roblox. BrickColor.new() is a thing on Roblox. However, when using the math.random() method make sure you put numbers inside of the parenthesis. Those are the range of numbers in which it selects a random number in. If you leave it blank it will give you a decimal, not a whole number.
end

The above script is one way to choose a BrickColor however, one of the most used ways and easiest ways to choose a random BrickColor would have to be the BrickColor:random() method specially made in Roblox, for the specific use of choosing a random BrickColor from the different BrickColors in the palette.

###Anyways here it is:

while wait() do
script.Parent.BrickColor = BrickColor:random() -- You can even do the prefix "." instead of ":"
end

##I hope I helped in one way or another. Please, if you have any other questions don't be afraid to post a comment below asking about them. Thank you for putting your precious time into reading this answer. I will see you another time.

#PEACE!

~~ KingLoneCat

5 comments

0

Why while wait() do ?

0

Ah i get it, but how can i make it change from color fading to other cuz know it just every 1 second goes to random and can be seen

0

Well, to make it fade from one color to another you'd probably have to plan out the order and use tables of some sort. It would take a while.

0

Nah, you could do color3 manipulation of some sort I would imagine.

0

No, I don't think you could. Pretty sure the RGB format is just for Guis. Then again I am not sure ;-;

while true do
wait(1)
script.Parent.BrickColor = BrickColor.random()
end

hopefully this works.

1 comment

0

Yeah, i forgot to put a wait().

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