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

How to make a brick transition between two colors with a for i loop?

Asked by 7 years ago

What would put for a for i loop if I want the brick color to transition from "Dark blue" to "Gold" and vice versa?

local Parenter = script.Parent



local intValue = Parenter.Parent.ZValue

intValue.Changed:connect(function()
if intValue.Value == 1 then 
Parenter.BrickColor = BrickColor.new("Gold")
intValue.Changed:connect(function()
if intValue.Value == 0 then 
Parenter.BrickColor = BrickColor.new(0,0,139)

end
end)
end
end)
0
@TheeDeathCaster what rgb values I mean, because I can't find the rgb values for roblox's official brick colors. JoeRaptor 72 — 7y
0
If you mean converting a Color3 value to a BrickColor, then you just need to give the BrickColor function a Color3 value: http://wiki.roblox.com/index.php?title=BrickColor#Using_Color3_Values , otherwise... TheeDeathCaster 2368 — 7y
0
...if you mean BrickColor codes(?) then this may be what you're talking about/ what I interpreted: http://wiki.roblox.com/index.php?title=BrickColor_codes , but if I'm wrong on both ends, then I'm not too sure; I apologize if so. ;c TheeDeathCaster 2368 — 7y

1 answer

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

After looking around the web and testing in Roblox Studio, i have come up with this:

wait(3)
local color = {
    ["11"]={["R"]=191/255,["G"]=133/255,["B"]=0/255}, --gold(Atleast... it should be?)
    ["10"]={["R"]=171/255,["G"]=126/255,["B"]=22/255},
    ["9"]={["R"]=152/255,["G"]=120/255,["B"]=45/255}, 
    ["8"]={["R"]=133/255,["G"]=113/255,["B"]=68/255}, 
    ["7"]={["R"]=114/255,["G"]=107/255,["B"]=91/255}, 
    ["6"]={["R"]=95/255,["G"]=101/255,["B"]=114/255}, 
    ["5"]={["R"]=76/255,["G"]=94/255,["B"]=137/255},
    ["4"]={["R"]=57/255,["G"]=88/255,["B"]=160/255},
    ["3"]={["R"]=38/255,["G"]=81/255,["B"]=183/255},
    ["2"]={["R"]=19/255,["G"]=75/255,["B"]=206/255},
    ["1"]={["R"]=0/255,["G"]=69/255,["B"]=229/255} -- blue
}
local num = 11
for i,v in pairs(color) do
    num = num - 1
    script.Parent.BrickColor = BrickColor.new(color[tostring(num)]["R"],color[tostring(num)]["G"],color[tostring(num)]["B"])
    wait(0.4)
end

This changes the color of the brick the script is a child of. This goes from gold to blue but it is easily changable to go from blue to gold by changing the value of num from 11 to 0 and then inside the For loop to change the num = num - 1 to num = num + 1.

EDIT: Forgot to mention an important thing; on the internets, i found and used this site to get the color RGB codes

0
If you feel like, feel free to accept as well as upvote this answer for others to use and if it solved your problem. :) addictedroblox1414 166 — 7y
Ad

Answer this question