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 change color to a Random value?

i am trying to make bottles that have different shades of light blue but this does not seem to work

script:

local Bottle = script.Parent

local Redcolor = math.random(212,90)
local Greencolor = math.random(255,104)
local Bluecolor = math.random(248,101)

Bottle.BrickColor = Color3.fromRGB(Redcolor,Greencolor,Bluecolor)

Error:

16:16:04.735 - Workspace.Model.Bottle.Script:3: bad argument #2 (interval is empty) 16:16:04.736 - Stack Begin 16:16:04.737 - Script 'Workspace.Model.Bottle.Script', Line 3 16:16:04.737 - Stack End

4 comments

0

I think you may have switched up the min and max values. Try switching the places of the numbers in your math.random.

0

With math.random the parameter is Lowest - Highest. math.random(90,212) --> math.random(lowest, highest)

0

it returned a error saying that i have to use brickcolor, but brickcolor doesnt hold RGB values. Any help!?

0

Guys if found it out

2 answers

✓ Accepted answer

Here:

local Bottle = script.Parent

local Redcolor = math.random(90,212)
local Greencolor = math.random(104,255)
local Bluecolor = math.random(101,248)

Bottle.Color3 = Color3.fromRGB(Redcolor,Greencolor,Bluecolor)

This should work. Happy to help, b_mni.

1 comment

0

Thanks really much for putting some effort into helping me

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