Tween not working properly?

I’m trying to make a simple tween that changes the CFrame (just orientation), but, whenever I do this it seems to rotate a little bit off.

Have a video of it:

The tween part of the script:

local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(script.Parent.Middle,TweenInfo.new(1.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.In),{CFrame = CFrame.new(script.Parent.Middle.Position,Vector3.new(-180, 0, 0))})
tween:Play()

It’s not supossed to “fall” per say, what can I do?

I have tried all axes

Extra information:
-The parts that are being affected by the script are these
Screenshot_1314
-They are all welded to the “Middle” part.

1 Like

Tweening can work with object that has Anchored property true though. I guess they are not anchored?

1 Like

It can work with an object that’s anchored, the problem is it won’t move the parts that are welded if they are also anchored. (Middle part is anchored)

This is because of how the CFrame.new constructor works , the first argument is the position the part will be situated at and the second argument is the position the part will face.

Basically , the parts will orient depending on where your script.Parent.Middle is situated.

You should rather do something like this

local TweenService = game:GetService("TweenService")

local NewCFrame = script.Parent.Middle.CFrame * CFrame.Angles(math.rad(180),0,0)  --Wrote it separately so it's easier to read 

local tween = TweenService:Create(script.Parent.Middle,TweenInfo.new(1.5,Enum.EasingStyle.Cubic,Enum.EasingDirection.In),{CFrame = nNewCFrame)})

tween:Play()
3 Likes