Lever tweening problems

I am trying to animate a lever using TweenService, and I welded the lever onto a part which will act as a pivot point. The tweening locations are only 60 degrees apart, and this weird behaviour happens but the lever is not affected at all.


These are the tweens used. I only used :Play() and there is nothing else to it.

local tweeninfo = TweenInfo.new(0.4,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)
local tween = ts:Create(leverP,tweeninfo,{Rotation = Vector3.new(0,180,-30)})
local tween2 = ts:Create(leverP,tweeninfo,{Rotation = Vector3.new(0,180,30)})

What went wrong?

1 Like

Use CFrame instead of Rotation.

See if that works.

you know i think that might work

Yes, it will work as song as your model is properly welded together, and make sure only the main part is anchored.

pivot is anchored and the lever is unanchored and they’re welded by a WeldConstraint. for some reason when i click the lever it and the pivot point disappears???/

I changed the tween to this

local tween = ts:Create(leverP,tweeninfo,{CFrame = CFrame.Angles(0,180,-30)})
local tween2 = ts:Create(leverP,tweeninfo,{CFrame = CFrame.Angles(0,180,30)})

Use math.rad when using CFrame.Angles.

CFrame.Angles(0, math.rad(180), math.rad(-30))

maybe try Lerp() if math.rad() doesnt help

if none of the solutions work, use a HingeConstraint and change TargetAngle

didn’t really help much. I realised te lever doesn’t disappear, but it teleports to the origin (0,0,0).

i think i’ve tried using lerps in the past and they were very difficult to work with. I think i’ll try hingeconstraints.

do you think AlignOrientation can do the same?

so the only solution that ended up working for me is making a new part entirely, and tweening to the cframe of that part. when wanting to reverse it, I stored the cframe before ever making the tweens so i could go back to that cframe whenever i needed to.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.