I have a very large model that I need to tween all at once. I've used model:SetPrimaryPartCFrame inside of a for loop, but it's wayyy too jittery. Is there a way to utilize the tween service to make the movement of it smoother? I've tried some methods such as
01 | local tweenService = game:GetService( "TweenService" ) |
02 | local info = TweenInfo.new() |
03 |
04 | local function tweenModel(model, CF) |
05 | local CFrameValue = Instance.new( "CFrameValue" ) |
06 | CFrameValue.Value = model:GetPrimaryPartCFrame() |
07 |
08 | CFrameValue:GetPropertyChangedSignal( "Value" ):Connect( function () |
09 | model:SetPrimaryPartCFrame(CFrameValue.Value) |
10 | end ) |
11 |
12 | local tween = tweenService:Create(CFrameValue, info, { Value = CF } ) |
13 | tween:Play() |
14 |
15 | tween.Completed:Connect( function () |
16 | CFrameValue:Destroy() |
17 | end ) |
18 | end |
but it always returns and error with the CFrame value when I do tweenService:Create().
What is the most efficient way to accomplish this?
The most efficient
way that I personally use is that:
1) I unanchor
all parts
2) I anchor
only one
part (which I am going to tween and use as my "PrimaryPart"
for that model)
3) I use Motor6Ds to weld all the parts together to the "PrimaryPart"
.
4) I then proceed to tween my anchored "PrimaryPart", and the model will follow
it.
Note: To make the process easier and faster I use this weld Plugin to make my Motor6D's, it is very helpful.
This is the smoothest
way to tween models to my knowledge after experimenting.
I hope this helps, please let me know if you have further questions!