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

Help With Color Changing Blocks?

Asked by 6 years ago

Okay so, very new so whatever, don't know how to do much so I'm just going to start with asking this - instead of making a block shift colors completely randomly, I want it to specific colors - although I can't find a way or any codes on how to do so. And I mean I don't just want the basic colors either, that's the problem.

I tried the palette coding somewhat:

script.Parent.Brickcolor = Brickcolor.palette(val)

Although, I couldn't find anything that told me what values I needed for those said colors, so it just ended with a bunch of guess work.

To solve that myself I was going to wright that code I listed above, start it at value 1, loop it and add 1 onto that value several times and make it print the name of the brickcolor each time, then end once it reached a certain value. BUT, not sure how to do that either. The print function only printed things like "table: 31483234", and I wasn't exactly sure how to add 1 to the value either.

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

In studio you can click the color tab at the middle of the top of your screen, hover over the color that you want and it will tell you the name of it, scripts are case sensitive though. A script to change a part's color to lime green would look like this:

script.Parent.BrickColor = BrickColor.new("Lime green")

That's all there is to it. (This script would only work if it was in the part that you want to change the color of)

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

If your wanting plain colors:

-- Put this script into the brick.
while true do
    script.Parent.BrickColor = BrickColor.Random()
    wait(1) -- Set the "1" to the amount of seconds you want to be between each color change.
end

But if your wanting more realistic colors, You would use this:

-- First number: Amount of Red
-- Second Number: Amount of Green
-- Third Number: Amount of Blue
while true do
    script.Parent.Color = Color3.fromRGB(255, 255, 255) 
    wait(1)
end
0
She said that isn't making it a random color cmgtotalyawesome 1418 — 6y
0
The use Color3. LennonLight 95 — 6y
0
Then* LennonLight 95 — 6y

Answer this question