The script runs just fine and there aren’t any errors, but the part still doesn’t do the spin. Any help would be greatly appreciated!
local part = game.Workspace.Storage.LocalTest
local detector = part.ClickDetector
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(
2, --Time animating
Enum.EasingStyle.Linear, --Easing style
Enum.EasingDirection.Out, --Easing direction
0, --Repetitions
false, --Reverse post tween?
0 --Delay time
)
local Goal = {
CFrame = part.CFrame * CFrame.Angles(0,math.rad(360),0)
}
local AnimateScrew = TweenService:Create(part, Info, Goal)
function onClicked()
part.ClickDetector.MaxActivationDistance = 0
AnimateScrew:Play()
end
detector.MouseClick:Connect(onClicked)
local part = game.Workspace.Storage.LocalTest
local detector = part.ClickDetector
local TweenService = game:GetService(“TweenService”)
local Info = TweenInfo.new(
2, --Time animating
Enum.EasingStyle.Linear, --Easing style
Enum.EasingDirection.Out, --Easing direction
0, --Repetitions
false, --Reverse post tween?
1 --Delay time
)
local Goal = {
CFrame = part.CFrame * CFrame.Angles(0,math.rad(360),0)
}
local AnimateScrew = TweenService:Create(part, Info, Goal)
function onClicked()
part.ClickDetector.MaxActivationDistance = 0
AnimateScrew:Play()
end
TweenService chooses the most effective path, and since a 360 degree turn returns back to its original position, it just goes straight to the target rotation which is the same as its original, not doing any movement
I think you could do this by using two tweens instead (one rotating to 180, and then turn an extra 180)? Or a for loop would also be good enough since you’re using Linear style
local tweenservice = game:GetService("TweenService")
for i = 1, 360 do
tweenservice:Create(part, TweenInfo.new(.1), {Orientation = part.Orientation + Vector3.new(0, 1, 0)}):Play()
task.wait()
end