Basically, I am trying to make the Part do a full 360 rotation, but tween takes the closest route, anyone has any idea how do i make a full 360 rotation?
script.Parent.ClickDetector.MouseClick:Connect(function() local TweenService = game:GetService("TweenService") local TweenInf = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In) local Proprties = {CFrame = CFrame.Angles(0, math.rad(180), 0) + Vector3.new(-42.25, 0.5, -13.57)} TweenService:Create(script.Parent, TweenInf, Proprties):Play() end)
You can apply the rotation to a Vector3Value so that it won't try finding the shortest path. You can do this is by tweening the value itself rather than the part. The downside to this is it'd require two tweens. Here's an example.
local StartRot = Vector3.new(0,0,0) local EndRot = Vector3.new(0,180,0) local Length = 1 -- Length of the tween local TweenService = game:GetService("TweenService") local Vector3Value= Instance.new("Vector3Value") Vector3Value.Value = StartRot local Info = TweenInfo.new(Length,Enum.EasingStyle.Linear,Enum.EasingDirection.In) local Tween = TweenService:Create(Vector3Value,Info,{Value = EndRot}) local Rotate = Vector3Value.Changed:Connect(function() script.Parent.Orientation = Vector3Value.Value end) Tween:Play() Tween.Completed:Wait() Vector3Value:Destroy()
In this example, every time the tween updates the Vector3Value, the part's orientation changes. This way it won't try rotating in the shortest path. Now all you have to do is make sure that if you want to move the part you make a seperate tween to do so and you're done!