ok so, i have some BADLY written code that i need some coding guru to take a look at!! I just don't understand why my gui textbuttons color keeps showing up black... Like even though i like black stuff, I don't understand why its not some other color, here is my pathetic code..
(Dont worry about the variables and all)
for _, v in pairs(game.ReplicatedStorage.Shop_Items:WaitForChild(typeC):GetChildren()) do local new = game.ReplicatedStorage.Shop_Items.Default_Button:Clone() new.Parent = Main.Purchase_Chest.Main new.Name = v.Name new.Text = v.Name local obj = game.ReplicatedStorage.Shop_Items:WaitForChild(typeC):FindFirstChild(v.Name) print(obj.Color) new.BackgroundColor3 = Color3.new(obj.Color) end
it all works except the background color doesnt change to the other color
example:
local color = workspace.Part
gui.BackgroundColor3 = Color3.new(color.Color)
In the example above i try changing the background color to whatever the parts color is but it will forever show up black, I will never understand it, help please. thx
It shows up as black because it's an invalid color.
Your code
local color = workspace.Part gui.BackgroundColor3 = Color3.new(color.Color) --color.Color is already a color3 value
What it should be
local color = workspace.Part gui.BackgroundColor3 = color.Color
If you further set colors of things, I suggest you use Color3.fromRGB()
because it makes sense. Color3.new()
uses values from 0 to 1 where Color3.fromRGB()
uses values from 0 to 255.
gui.BackgroundColor3 = Color3.new(100/255, 100/255, 100/255) gui.BackgroundColor3 = Color3.fromRGB(100, 100, 100)