I've recently tried to tween a model by its PrimaryPart but It only tweens the PrimaryPart and not the entire model. I've even tried welding every part in my model to it's PrimaryPart and it still doesn't give me the result I'm looking for.
The code I use to tween is below. Any suggestions or changes I should make?
local TweenService = game:GetService("TweenService") local Info = TweenInfo.new( 5, Enum.EasingStyle.Elastic, Enum.EasingDirection.In, 0, false, 0 ) local Pos = {} Pos.Position = Vector3.new(Character.UpperTorso.CFrame*CFrame.new(0, -1.7, -4)); local tween = TweenService:Create(MyModel.PrimaryPart,Info,Pos) tween:Play()
You are not able to tween a model as it has no position value. The position is based upon the primary part which you need to use the function SetPrimaryPartCFrame.
You can however use the lerp function of a CFrame but this will not have the same easing style.
Example:-
local endCF = Character.UpperTorso.CFrame*CFrame.new(0, -1.7, -4) local startCF = MyModel:GetPrimaryPartCFrame() for i=0, 1, 0.1 do MyModel:SetPrimaryPartCFrame(startCF:lerp(endCF, i)) wait() end
I hope this helps.