Gradient rotation tween rotates 360 but when the tween ends the gradient goes back to 0 rotation

My code:

local a = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1, false, 0)
script.Parent.Parent.MouseEnter:Connect(function()
	game:GetService("TweenService"):Create(script.Parent, a, {Rotation = 360}):Play()
end)

Result; rotates 360 degrees but when the tween ends the gradient goes back to 0 degrees, it does repeat tho

What is the effect you are wanting to achieve? I tried your code, and the object, just spins around.
But not knowing what is the intended result its hard to see where its going wrong.

My intended effect is to make a frame spin 360 for infinite amounts of times without stopping or reversing. This effect should occur when a mouse entered the frame

If that’s the case, its better to just have RunService set the rotation += 1 constantly. And if you need it to trigger when mouse hovers and stops when it leaves, then you can simply connect it to those events where RunService starts when mouse enters and :Disconnect() the RunService loop when it leaves.

so like,

game:getservice("runservice").renderstepped:connect(function()
script.parent.rotation += 1
end)

UIGradient uses Rotation

Oh, I misread the title.

charcharf

There is a helpful example on the creator hub you can use as reference :grin:

I always avoid using tweens and instead just pick the X, Y or Z coörd and just add 1 to it within a repeat loop for 360 times.

if you want it smooth i can help ya with a sinus wave function.
its really simple.

local targetPart = workspace.part
local var = 0
local X = 0
while true do
   x += 1
   var = math.abs(math.sin(x))
   targetPart.Rotation = vector3.New(var * 360, 0, 0)
   wait(0.01)
end