UI only tweens 1 time in a loop

I’ve tryed messed around with my local script and I can’t seem whats wrong with it.

What I want the script to do

  • Tween a UI part

Error I’m getting

  • Not Tweening the UI after the first loop

What I’ve tryed

  • Putting the while true do in between line 5 and 6

  • Changing the tween2:Pause() and replacing it with tween2:Cancel()

My code

  • My code is in a local script and the local script is a child of a UI
local LoadingBox = script.Parent
local LoadingScreen = script.Parent.Parent
local TweenService = game:GetService("TweenService")
local tweenInfo2 = TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut)
local tween2 = TweenService:Create(LoadingBox, tweenInfo2, {Rotation=360})

while true do
	print("In loop")
	tween2:Pause()  -- I have tryed tween2:Cancel()

It’s because the ‘Rotation’ of the UI is already rotated in 360, try making another Tween variable and set the Rotation value to -0.

1 Like

Ooo… Thank you! That makes sences!

while true do
	LoadingBox.Rotation = 0

Alternatively you could make the tween reverse its animation.

TweenInfo.new(3, Enum.EasingStyle.Quart, Enum.EasingDirection.InOut, 0, true, 0)