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

Randomly coloring a GUI button?

Asked by
lomo0987 250 Moderation Voter
10 years ago

Edit: Updated the script.

Extra edit: I now know I need to use Color3.new() .. But I don't know how to randomize it.

local button = script.Parent
local gui = script.Parent.Parent

while gui.Visible == true do -- only does it while it's open?? I will figure that out later I guess.
while true do
    button.BackgroundColor3 =Color3.new() -- this is the part i need help with
end
end

Just looking on how to randomly change the colors. I used to remember but after doing a bit of searching on the wiki, i didn't find anything that worked. (I probs set it up wrong)

0
Someone either downvoted my question or took off the +1 point on it ): lomo0987 250 — 10y

1 answer

Log in to vote
2
Answered by 10 years ago
local button = script.Parent
local gui = script.Parent.Parent

while gui.Visible do 
    wait()
    local r,g,b = math.random(1,255)/255,math.random(1,255)/255,math.random(1,255)/255
    button.BackgroundColor3 =Color3.new(r, g, b)
end
Ad

Answer this question