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

How to use the Color3 Value?

Asked by 8 years ago
Edited 8 years ago

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

Log in to vote
2
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago
Edited 8 years ago

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.
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. nilVector 812 — 8y
0
Lol, thank you. So far, Grammarly has let me down xD. I actually should have caught that before I posted it. M39a9am3R 3210 — 8y
Ad

Answer this question