hello, I’m right now want to make a gui tween rotation system for a gui, but don’t really know how to make the rotation of a gui go left and right, but right now the script can only rotate to the right and will reverse back but stop at the start of it. I want it to be after the reverse, the rotation will go to the left and ended at the start of the rotation.
local pan = script.Parent
local ts = game:WaitForChild("TweenService")
local info = TweenInfo.new(1.12, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style in this case it is Linear
Enum.EasingDirection.InOut, -- EasingDirection
2, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
true, -- Reverse?
0 -- Delay)
)
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function(click)
local Tween = ts:Create(pan, info, {Rotation = 23})-- Creates the tween with the TweenInfo and what properties you want to change
Tween:Play() -- Plays the tween
end)
i gradually appreciate it.
1 Like
For clarity are saying you want the ui to rotate right then left then become straight again
1 Like

the explanation of what it’s going to be like
Alright so we need to use two tweens
local pan = script.Parent
local ts = game:WaitForChild("TweenService")
local RoatateValue = 23 -- amount u want to rotate
local info = TweenInfo.new(
.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style in this case it is Linear
Enum.EasingDirection.InOut, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
true,-- Reverse?
0 -- Delay)
)
local TweenRight = ts:Create(pan, info, {Rotation = RoatateValue })-- Creates the tween with the TweenInfo and what properties you want to change
local tweenLeft = ts:Create(pan, info, {Rotation = -RoatateValue })
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function(click)
TweenRight:Play() -- Plays the tween
TweenRight.Completed:Wait() -- waits for the tween to complete
tweenLeft:Play()
tweenLeft.Completed:Wait() -- prevents player from spaming the button and messing up code (waits for left tween to complete)
end)
1 Like
keep in mind if u want it to repeat dont change the tween info instead run a for loop inside mosueButton1Click Function
sorry, but how exactly i make it a loop.
local pan = script.Parent
local ts = game:WaitForChild("TweenService")
local RoatateValue = 23 -- amount u want to rotate
local amountOfRepeats = 3
local info = TweenInfo.new(
.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style in this case it is Linear
Enum.EasingDirection.InOut, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
true,-- Reverse?
0 -- Delay)
)
local TweenRight = ts:Create(pan, info, {Rotation = RoatateValue })-- Creates the tween with the TweenInfo and what properties you want to change
local tweenLeft = ts:Create(pan, info, {Rotation = -RoatateValue })
script.Parent.Parent.TextButton.MouseButton1Click:Connect(function(click)
for count = 1, amountOfRepeats do
TweenRight:Play() -- Plays the tween
TweenRight.Completed:Wait() -- waits for the tween to complete
tweenLeft:Play()
tweenLeft.Completed:Wait() -- prevents player from spaming the button and messing up code (waits for left tween to complete)
end
end)
1 Like