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

Why does blue never appear?

So I made these particle launchers to go onto opposite sides of my lobby. Red works fine, but blue just turns to white. How is this?

local p = script.Parent
local bc = Color3.new(85, 170, 255)
local rc = Color3.new(255, 0, 0)
p.Enabled = false
local w = game.Workspace.WinningTeam

-- Functions --
function red()
	p.Color = ColorSequence.new(rc, rc)
	p.Enabled = true
	wait(8)
	p.Enabled = false
	p.Color = ColorSequence.new(Color3.new(255, 255, 255),Color3.new(255, 255, 255))
end
function blue()
	p.Color = ColorSequence.new(bc, bc)
	p.Enabled = true
	wait(8)
	p.Enabled = false
	p.Color = ColorSequence.new(Color3.new(255, 255, 255),Color3.new(255, 255, 255))
end
-- Real Function --
w.Changed:connect(function()
	if w.Value == "Red" then
		red()
	end
	if w.Value == "Blue" then
		blue()
	end
end)

Help would be appreciated, thanks.

1 answer

✓ Accepted answer

Color3 uses a value from 0-1
To fix your code, you'll want to do something like this instead

local p = script.Parent
local bc = Color3.new(85/255, 170/255, 255)
local rc = Color3.new(255, 0, 0)
p.Enabled = false
local w = game.Workspace.WinningTeam

-- Functions --
function red()
    p.Color = ColorSequence.new(rc, rc)
    p.Enabled = true
    wait(8)
    p.Enabled = false
    p.Color = ColorSequence.new(Color3.new(1, 1, 1),Color3.new(1, 1, 1))
end
function blue()
    p.Color = ColorSequence.new(bc, bc)
    p.Enabled = true
    wait(8)
    p.Enabled = false
    p.Color = ColorSequence.new(Color3.new(1, 1, 1),Color3.new(1, 1, 1))
end
-- Real Function --
w.Changed:connect(function()
    if w.Value == "Red" then
        red()
    end
    if w.Value == "Blue" then
        blue()
    end
end)

Why does Roblox use 0-1 instead of 0-255?
The answer for that is most likely that the internal representation is a float, and that a decimal form of a color works far better with color blending and color theory.

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