Rotate Tween script not looping

I want to make a GUI that tweens the rotation. It does work but only once. The GUI is similar to Robeats when a mouse enters the GUI frame.

I got the script from this post awhile ago

The Explorer is like this
image

Script:

local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(
	script.Parent,--whatever should be tweened
	TweenInfo.new(1),--how the tween should act
	{
		Rotation = 5--set rotation to whatever it should be
	}
)
local untween = TweenService:Create(
	script.Parent,
	TweenInfo.new(1),
	{
		Rotation = -5
	}
)
while true do
	tween:Play()
	wait(1)
	untween:Play()
end

I don’t know what is the code, I’m still the begginer of scripting.

I only know this :
Explorer.Services.TweenService.disabled = false
Local Tween.rotate.rotation = 5

Not to be rude, but this does not help and should not be replied.

1 Like
local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(
	script.Parent,--whatever should be tweened
	TweenInfo.new(1),--how the tween should act
	{
		Rotation = 5--set rotation to whatever it should be
	}
)
local untween = TweenService:Create(
	script.Parent,
	TweenInfo.new(1),
	{
		Rotation = -5
	}
)
while true do
	tween:Play()
	tween.Completed:Wait() -- this waits for the tween to end
	untween:Play()
    untween.Completed:Wait() 
    -- the loop got to this point but resets
end

So then why did you reply? lol

1 Like

What is the issue? That it only works once?

1 Like

Yes the while true do does not loop and no error displays.

Thanks I forgot to put the Completed because I was rushing to release my development team game :laughing: (also that was quick for my standards)

1 Like