How would I go about making an RGB color loop with lighter colors?

Alright so I’m trying to make an RGB color loop but with lighter colors.

I was unable to find an example, but I’m sure I’ll be able to answer your questions about what I’m trying to say if you are unable to understand it.

Just add a an extra amount to each R, G, and B value. If this doesn’t help, please elaborate further on what you mean.

A Simple way to make a color loop is:

repeat
Item.Color = Color3.fromRGB(255,0,0)
wait(1)
Item.Color = Color3.fromRGB(0,255,0)
wait(1)
Item.Color = Color3.fromRGB(0,0,255)
wait(1)
until false

(lol, misread)

I’ll check this out, be right back.

Didn’t seem to work.

So, What I’m trying to do is create a regular loop, but somehow make the colors lighter.
Here is the loop I made using HSV

while true do
	task.wait()
	script.Parent.Color = Color3.fromHSV(tick() % 20/20,1,1)
end
1 Like
local extraAdd = 50
local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
	script.Parent.Color = Color3.fromRGB(1+extraAdd,1+extraAdd,1+extraAdd)
end)

Oh wait, are you trying to make the colors fade or something like that?
Example: 1-255 smoothly?

Yes lmao

My HSV script does exactly that, but without the lighter colors.

No need for a loop then. All you have to do is use TweenService to increase the R, G, and B values of the color, then round each of them, and multiple the rounded number by 255.

Alright well this is probably not very efficient but it works, I used tweens in a loop to create a lighter colored rainbow. Not sure how I didn’t think of that.

1 Like

fairly simple

while true do
	game:GetService("TweenService"):Create(script.Parent,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{Color = Color3.fromRGB(255, 97, 97)}):Play()
	wait(1)
	game:GetService("TweenService"):Create(script.Parent,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{Color = Color3.fromRGB(99, 255, 104)}):Play()
	wait(1)
	game:GetService("TweenService"):Create(script.Parent,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{Color = Color3.fromRGB(107, 159, 255)}):Play()
	wait(1)
end

Yeah this works, but I recommend making a code review topic to review your code.

Hi, I would suggest something like this, it’s still a loop, but more easily readable. Also use task.wait over wait for your future projects.

local TweenService = game:GetService("TweenService")
local Colors = {Color3.fromRGB(255, 97, 97),Color3.fromRGB(99, 255, 104),Color3.fromRGB(107, 159, 255)}
local function TweenColor(Index)
	local newTween = TweenService:Create(script.Parent,TweenInfo.new(1),{Color = Colors[Index]})
	newTween:Play()
	newTween.Completed:Wait()
end
while true do
	for Index = 1, #Colors do
		TweenColor(Index)
	end
end

HSV stands for hue saturation value. To make colors lighter you would just make the saturation (number in the 2nd parameter) smaller.

Color3.fromHSV(tick() % 20/20, 0.4, 1)

Oh well that clears it up a bit more lmao thank you!

And I do use task.wait for most of my projects, im just lazy and didnt use it in the example

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.