Tween doesn't work well for Color3.fromHSV

Hello! I was trying to make a script which has tween changing color hsv value by random. This is what I made:

local ts = game:GetService("TweenService")
local handle = script.Parent

while wait() do
	local info = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)
	local goal = {Color = Color3.fromHSV(math.random(0,359),103,255)}
	local twen = ts:Create(handle,info,goal)
	twen:Play()
	wait(5)
	local info = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)
	local goal = {Color = Color3.fromHSV(math.random(0,359),103,255)}
	local twen = ts:Create(handle,info,goal)
	twen:Play()
wait(5)
end

So this script literally should slowly change Hue value at part’s color, but everytime I launch test, it doesn’t work well. This is how it works:

https://gyazo.com/3e1bd218cc724cbfc9eb13f65f06ce85

As you can see, it looks like tween changes colors very fast, or I don’t know. Output doesn’t say anything, so I’m really confused. What could I do to fix it?

while wait() do
	for i = 1,255 do
		script.Parent.Color = Color3.fromHSV(i/255, 1, 1)
		wait()
	end
end

This should do the trick, make a script inside the block you want and it will work

1 Like

It still works weird:

https://gyazo.com/51f6d960d28e88cfff53750ca77d5385

It works perfectly for me https://gyazo.com/73749fcbdb1bb85f66ba62b69f107767
the part where it turns blue is when the recording ends and loops back to the beginning

1 Like