Not able to do a proper Rainbow Cycle effect using Tween Service

  1. What do you want to achieve? Keep it simple and clear!

I want to achieve a Rainbow cycle effect on my TextLabel called “PlayerName” using tween service
What I mean by “Rainbow Cycle Effect” is that it goes from red all the way to the other side of the color spectrum, so it change into green, blue, purple, etc

  1. What is the issue? Include screenshots / videos if possible!

It only goes from one single color to another, and it’s not what I want to achieve

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I searched for solutions but all of them are not using tween service and using a while loop, that’s not what I want

Here is the part of the code that handle my TextColor3 Tween, consider that “TweenInfoPlus” is a Custom Module that handle tweens, but at the end it work exactly the same.

	-- TWEEN --
	local TweenOptions = {
		Time = 1, 
		EasingStyle = Enum.EasingStyle.Linear,
		EasingDirection = Enum.EasingDirection.Out,
		RepeatCount = -1,
		Reverses = false,
		DelayTime = 0
	}

	local function GetHue()
		local time = os.clock() % 6
		return time / 5
	end

	local color = Color3.fromHSV(GetHue(), 1, 1)

	local Object = PlayerName
	local Goal = {
		TextColor3 = color
	}

	local tween = TweenInfoPlus({ Options = TweenOptions, Object = Object, Proprieties = Goal })

	tween:Play()

Thank you very much if you can help me

1 Like

Instead of using tween service, try making a while true loop that’s adding the text color by 1 with a wait time of .025 in a separate thread. Maybe that could fix your issue.

1 Like

Aside from this point, you don’t have to use the template that Roblox offers you for your post.

It’s just an example on what you should do when making a post in a specific category. Just want to let you know that since you’re pretty new on the devforums.

It’s for better readability for people that are gonna read my post but alright then I thought it was mandatory too

Well, I am trying to achieve that by not using a While loop

You want it to be only using tween service?

Yes that’s what I am trying to achieve

Then yeah I’m sorry but I can’t help you. I’m going to be honest, I’ve never tried to make a rainbow effect out of tween service. I know using :Lerp() would probably do the job, but that’s not what you want.

Oh I’d have to check for Lerp() thanks for ur help tho

1 Like

you could do a for loop for a variable.

Let’s call that ‘hue’. We want to transition it from 0 to 1 in a smooth motion. Then you could change the color with .fromHSV() and set the hue to the variable we made.

I know you wanted to use TweenService, but it’s probably going to require a lot more work.

1 Like

Maybe This?

local Tween = game:GetService("TweenService")
local Object = "TextLabel Path Here"

Object.TextColor3 = Color3.FromHSV(0,1,1)

Tween:Create(Object, Tweeninfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,-1), {TextColor3 = Color3.FromHSV(1,1,1)}):Play()

tested it and doesn’t work, here a functioning code for you.

local speed = 10
local object = "textlabel path here"

game:GetService("RunService").RenderStepped:Connect(function()
	object.TextColor3 = Color3.fromHSV((speed * workspace:GetServerTimeNow() % 10) / 10,1,1) 
end)

try tweening from red, Then when red finish, tween to green, then when green finish, tween to blue then when blue finishes do the loop again.