BackgroundColor3 not providing the right color

Hello developers! Basically, I am making a shine effect, and what is happening is that the BackgroundColor3 I am assigning to a UIGradient is darker than it should be. Here is the code and video:

local gradient = ui:FindFirstChild("UIGradient")
	
	if not color then color = ui.BackgroundColor3 end
	
	if not gradient then 
		gradient = Instance.new("UIGradient")
		gradient.Parent = ui
		gradient.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0, color),
			ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 255)),
			ColorSequenceKeypoint.new(1, color)
		})
		gradient.Rotation = 45
	end

Video

3 Likes

Any help would be loved
asdsdfsdf

3 Likes

If you want to use a gradient with the same background color, then change the actual BackgroundColor3 to white, it should be lighter afterwards.

local gradient = ui:FindFirstChild("UIGradient")

if not color then color = ui.BackgroundColor3 end

if not gradient then 
	gradient = Instance.new("UIGradient")
	gradient.Parent = ui
	gradient.Color = ColorSequence.new({
		ColorSequenceKeypoint.new(0, color),
		ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 255)),
		ColorSequenceKeypoint.new(1, color)
	})
	gradient.Rotation = 45
	ui.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
3 Likes

But wouldn’t setting the BackgroundColor3 to white make the background white? If so, this is not what I want to achieve.

3 Likes

any help appreciated once again

3 Likes

No, if you set the backgroundcolor3 to white, your gradient will override it and the tone will be unaffected because the shade is light. If you have a non-white backgroundcolor3, it will affect your gradient’s appearance.

3 Likes

I want the gradient to disappear after its done, so should I just set it to white, then revert it after the gradient shine is done?

2 Likes

not too sure how shines work, but it seems like during the shine the color is off, so try that.

2 Likes

Alright, I will…sd sdfsdfsdfsdfsdff

1 Like

This seems to just make the entire button white, and then you don’t see the shine

1 Like

any help once again
sdfsdffsdsdfsdffsd

1 Like