Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to use the Color3 Value?

I'm making a dancefloor with Surfacegui's, the surfacesgui takes the color from a color3 value, But when I change the Color3 value in the code the surfacegui do not change, the value does, but the surfacegui don't. Can you help me?

local Color = script.Parent.Color.Value
local Part = script.Parent.Parts["1"].SurfaceGui

Part.Frame.BackgroundColor3 = (Color)
wait(2)
script.Parent.Color.Value = Color3.new(161/255, 161/255, 161/255)
Part.Frame.BackgroundColor3 = (Color)

1 answer

✓ Accepted answer

##Problem

The script is taking the initial value of the ColorValue object. So say the ColorValue's Value was Color3.new(1,.5,0) then the script will remember that for whenever you use the value. It won't change unless you redefine "Color".


##Solution

You probably do not need the Color3Value. Just set the BackgroundColor3 properties directly to the Color3 values. However, for the script, I will adjust to what you need to do.


##Final Script

local Color = script.Parent.Color --Just remove .Value from here. .Value is telling the script hey remember the Color3 Value, not the Color3Value object.
local Part = script.Parent.Parts["1"].SurfaceGui

Part.Frame.BackgroundColor3 = (Color.Value) --Since Color is the object, we want the Value.
wait(2)
script.Parent.Color.Value = Color3.new(161/255, 161/255, 161/255)
Part.Frame.BackgroundColor3 = (Color.Value) --Since you changed the Color's value and this is the color object, we want the Value.

######Hopefully, this answered your question. If it did, do not forget to hit the accept answer button. If you have any questions, feel free to post them in the comments below.

2 comments

0

You kind of made a typo at the beginning of your last, bolded paragraph. Just wanted to point that out, because it's a pretty funny typo.

0

Lol, thank you. So far, Grammarly has let me down xD. I actually should have caught that before I posted it.

This discussion is preserved as it was. New answers, comments, and votes are closed.