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

For some reason when using color3.new it is multiplying?

Asked by
bt6k 23
4 years ago
local red = game.Workspace.Red
local light = script.Parent:FindFirstChild("Sector 1 Light")

red.Changed:Connect(function()
    if red.Value == true then
        light.BrickColor = BrickColor.new("Crimson")
        light.SurfaceLight.Color = Color3.new(255, 37, 40)
        wait(1)
    else
        light.brickColor = BrickColor.new("Institutional white")
        light.SurfaceLight.Color = Color3.new(255, 255, 255)
    end
end)

So whenever I try to set the color, instead of it setting it, it multiplies it by the previous color.. WHAT THE HECK??

It is happening on the first if statement, not the else. At least I don't think..

Please help.

1 answer

Log in to vote
1
Answered by
uhSaxlra 181
4 years ago

Color3.new accepts a range from 0 to 1 Example:

Color3.new(1,0,0) --Red

What you want to use is Color3.fromRGB

This accepts a range from 0 to 255

Color3.fromRGB(255,0,0) --Red
0
Thanks! bt6k 23 — 4y
Ad

Answer this question