Im trying to turn Number values from a number value object to Color3 value and use the value to change background color in a frame.
I have another script that uses the color3 value to change the background color in a frame.
Here’s my code:
while true do
local Color3Val = script.Parent
local Green = workspace.Fuel_Holder_1.Script.Fuel_Left.Value*2
local Red = 0
local Blue = 0
Color3Val.Value = Color3.new(Red/255,Green/255,Blue/255)
wait()
end
When i test it does nothing and no errors appear i keep trying i even asked my friend to help but the same thing happened, the color3 value object value stays the same.
Im not very good at English so there might be some spelling errors or something.
You can’t just store Color3.new(Red/255,Green/255,Blue/255) into a intvalue, those only store numbers, instead, do this to change your background color:
local Frame = script.Parent
local Value = workspace.Fuel_Holder_1.Script.Fuel_Left.Value*2
Frame.BackgroundColor = Color3.new(0, 0, Value)
I’m not really sure why you want to store the Color3 value as a number value since you could store it in a table via a module or something similar. Having said that I think the easiest way to store it would be via a string value rather than a number value. That way you could easily differentiate between the RGB values and wouldn’t have to have multiple number values (you can’t store Color3 values or string values in number value instances).