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

Stupid easy question regarding the new part color property?

Asked by
Kryptio 19
6 years ago

Alright so i am trying to use true colors on parts, you know the part property color that has [255, 22, 1] and not the name of the color.

However i just tried looking online and couldnt find an answer to this. Ive used Brickcolor and Color3. Brickcolor only works when you type the name of the color and Color3 isnt a property of parts. So how could i the true colors and not the names on the parts?

My idea is to made a gradient strobe light that dims in and out but i want to use the color property along with the light.

The issue with this is that Color3 doesnt identify as a property to parts or is it that im doing something wrong here? Its a pretty basic script but im gonna do more once i figure out the correct color function

local ClickDetector =script.Parent
local Switch = ClickDetector.Parent.Parent
local Burner = Switch.Burner

function LightOn()
    if Burner.Color3 == Color3.fromRGB()("88, 88, 88")
        then
        Burner.Color3 = Color3.fromRGB()("255, 0, 0")
    else
        Burner.Color3 = Color3.fromRGB()("88, 88, 88")
    end
end

ClickDetector.MouseClick:connect(LightOn)




1
You're calling it wrong. Try Color3.fromRGB(88, 88, 88), etc. XAXA 1569 — 6y

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

If you look a little closer at the Properties, you'll notice that that specific property is just Color, not Color3. Additionally, you're not creating the Color3 values correctly, as XAXA pointed out:

local ClickDetector =script.Parent
local Switch = ClickDetector.Parent.Parent
local Burner = Switch.Burner

local toggle = false
function LightOn()
    toggle = not toggle
    if toggle then
        Burner.Color = Color3.fromRGB("255, 0, 0")
    else
        Burner.Color = Color3.fromRGB("88, 88, 88")
    end
end

ClickDetector.MouseClick:connect(LightOn)
0
This is the correct answer, the question has the script containing extra parenthesis and incorrect property usage which is possibly a typo. User#18043 95 — 6y
Ad

Answer this question