Tweened model is rotating instead of moving up

i intended to tween this model to move up, but instead it rotates 90 degrees


the “raise” button is supposed to move the model 0.4 studs upwards, and contains the following script:

tweenservice = game:GetService("TweenService")
part = workspace.bloomfonteinefix.InsideBloomAssembly.PrimaryPart
info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false
)
newpos = CFrame.new(part.CFrame.Position + Vector3.new(0, .4, 0))
tween = tweenservice:Create(part, info, {CFrame = newpos})

script.Parent.MouseButton1Down:Connect(function()
	tween:Play()
end)

i’m new to tweening and i dont know how to fix this, please help

tried a new script,

tweenservice = game:GetService("TweenService")
part = workspace.bloomfonteinefix.InsideBloomAssembly.PrimaryPart
info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false
)
nieuwpos = part.Position + Vector3.new(0, .4, 0)
tween = tweenservice:Create(part, info, {Position = nieuwpos})

script.Parent.MouseButton1Down:Connect(function()
	tween:Play()
end)

did work but only moved the primarypart and not the others

1 Like
newpos = CFrame.new(part.CFrame.Position + Vector3.new(0, .4, 0))

right here you’re setting the CFrame to its position + the vector3 offset. you’re resetting its orientation, therefore it’ll rotate

newpos = part.CFrame + Vector3.new(0, .4, 0)

this would move it upwards w/o changing its orientation.

2 Likes

You should be using TweenService on a Motor6D that connects that part of your model to the rest of the rig. You should be using Motor6Ds from the very start.

Once you did it, you just tween the C0, C1, and Transform property of the Motor6D, all being objectspace CFrames.

hmm okay, i’ll use it on my projects, thanks!

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