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

math.random Color3 help?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

I was trying to make it so it changes to a random color within a range of (255 - 200) so they can I always be a neon color, What am I doing wrong??

sp = script.Parent
NUM1 = sp.NUM1
while true do
    NUM1:TweenSize(UDim2.new(0, 800,0,math.random(-600,0)),"Out","Linear",0.1,false)
    NUM1.BackgroundColor3 = Color3.new(math.random(255,200)/255,math.random(255,200)/255,math.random(255,200)/255)
    wait(0.05)
end
0
Why is the larger number first in the math.rendom statements on line 5? GoldenPhysics 474 — 10y
0
Because there can be NotSoNorm 777 — 10y

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

as GoldPhysics mentioned, math.random requires the first parameter to be smaller than the second.

math.random(200,255) is therefore valid, but what you have, math.random(255,200) is not. The output would state this.

Ad

Answer this question