I’m not sure if I am doing something wrong or Color3 simply just does not recognize variables as a passable value, but whenever I try to do Color3.fromRGB(Variable1,Variable2,Variable3)
, the returned Color3 color is 0,0,0 (Black). Can someone please explain why this is occuring and maybe give the right way to assign variables to the Color3 syntax
Can you post some code? Preferably something we can copy-paste into the command bar.
Roblox doesn’t shout at you if you pass bad values into the constructors of built-in values, btw. print(Color3.new(nil, "lol", 1))
prints 0, 0, 1
I don’t have a code to paste in the command bar, but I can give the project I am working on.
Color3Picker.rbxm (7.2 KB)
In line 48 of ColorCore:
local function OnButtonClick()
print(Color["R"],Color["G"],Color["B"])
ResultFrame.BackgroundColor3 = Color3.fromRGB()
end
Did you forget to pass these numbers to the constructor?
Oh, I removed the the part where I passed the variables, it’s supposed to be
ResultFrame.BackgroundColor3 = Color3.fromRGB(Color["R"],Color["G"],Color["B"])
Ok, i found out the problem.
I actually used Color[1] etc. instead of Color[“R”] etc.
Thanks for the help tho @XAXA
This code worked, though:
local function OnButtonClick()
print(Color["R"],Color["G"],Color["B"])
ResultFrame.BackgroundColor3 = Color3.fromRGB(Color["R"],Color["G"],Color["B"])
end
But I’m glad you fixed your problem, anyway.