So basically I have this part here which I need to tween the rotation of (from 180 to -90), but instead of going the normal way (just turning straight left), it goes all the way around like a complete
buffoon. Is there a way to get around?
function tween3(part2,part1)
script.Parent.TextButton3.MouseButton1Click:Connect(function()
local krab = true
camera.CameraType = Enum.CameraType.Scriptable
local tween = TweenService:Create(part2, tweenInfo, {Orientation = Vector3.new(0, -90, 0)})
tween:Play()
repeat
wait(.02)
camera.CFrame = part2.CFrame
until krab == false
krab = false
end)
end
It rotates the long way, because it goes from 180 to -90, which means it will turn 270°. To rotate them the short way, you want to replace the -90 with 270, so it goes from 180 up to 270, which means it’ll turn now 90°.
I’m afraid you’ll have to do manually rotate it as TweenService is not good for handling stuff like rotations. There’s no easy way to specify it to rotate clock-wise or counter clock-wise.
If you care for the explanation, it’s because that the property that describes how numbers are wrapped for rotation exists in a modular manner, i.e time in a 12-hour clock format, and TweenService is only really good for linear structures, say tweening a position of something to go somewhere else.