Hey there! I having a problem with this Gui rotation script.
local TweenService = game:GetService("TweenService")
local Object = script.Parent
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut, 0, false, 0)
local Tween = TweenService:Create(Object, tweenInfo, {Rotation = 360})
wait(1)
local canClick = true
function onClick()
if canClick == true then
canClick = false
Tween:Play()
canClick = true
end
end
script.Parent.MouseButton1Click:Connect(onClick)
My problem is: it works just fine the first time, but after that, it doesn’t do anything. robloxapp-20201231-1359468.wmv (505.4 KB)
Sorry about the horrible picture quality.
Also, how do I post clips that appear on the forum as just a clickable video, because every time I try to do it, it comes out as something that needs to be downloaded.
It doesn’t do anything, due to the fact the rotation stays at 360, try this;
local TweenService = game:GetService("TweenService")
local Object = script.Parent
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut, 0, false, 0)
local canClick = true
function onClick()
if canClick == true then
canClick = false
local rot = Object.Rotation
local Tween = TweenService:Create(Object, tweenInfo, {Rotation = rot == 360 and 0 or 360})
Tween:Play()
Tween.Completed:Wait()
canClick = true
end
end
script.Parent.MouseButton1Click:Connect(onClick)
It works! Thanks, though for some reason it reverses direction on the second click, and then back and forth each new click, but I think I can use that and it will be fine.