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

Changing random colors not workin ? ;-;

Asked by
Bulvyte 388 Moderation Voter
7 years ago
Edited 7 years ago
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

0
Couldn't you do BrickColor.Random()? InfinitivePixelsJr 542 — 7y
0
No, because the studio crashes Bulvyte 388 — 7y

2 answers

Log in to vote
2
Answered by 7 years ago
Edited 7 years ago

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 BrickColorwould 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

0
Why while wait() do ? Bulvyte 388 — 7y
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 Bulvyte 388 — 7y
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. KingLoneCat 2642 — 7y
0
Nah, you could do color3 manipulation of some sort I would imagine. User#11440 120 — 7y
0
No, I don't think you could. Pretty sure the RGB format is just for Guis. Then again I am not sure ;-; KingLoneCat 2642 — 7y
Ad
Log in to vote
2
Answered by 7 years ago
Edited 7 years ago
while true do
wait(1)
script.Parent.BrickColor = BrickColor.random()
end

hopefully this works.

0
Yeah, i forgot to put a wait(). Bulvyte 388 — 7y

Answer this question