I've been playing around with TweenService for some time - and it works really well with single parts.
This is a basic example of a part that will move upwards linearly
local TweenService = game:GetService('TweenService') local a = workspace.A local i = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out) wait(1) local ta = TweenService:Create(a, i, { CFrame = a.CFrame * CFrame.new(0, 5, 0) }) ta:Play()
However, I want to use this with models. The only way that I'm aware of is doing
Model:SetPrimaryPartCFrame(**Desired CFrame**)
and I've tried a few things but I have absolutely no idea how to use tweening with models, and it doesn't seem as simple as lerping with models which I have done before.
Is it possible? If so, how can it be done?
you have to add a Dictionary to make it work. Dictionary is like a table, but instead it's a list of properties.
e.g
Properties = { Position = Vector3.new(10,10,5) Size = Vector3.new(5,5,5) Transparency = 1 }
Etc.
and you have to make a Tween Info to make one you have to:
local tweenInfo = TweenInfo.new( 2, -- Length of an interpolation Enum.EasingStyle.Elastic, -- Easing Style of the interpolation Enum.EasingDirection.Out, -- Easing Direction of the interpolation 5, -- Number of times the sequence will be repeated true, -- Should the sequence play in reverse as well? 2 -- Delay between each interpolation (including reverse)
-- Create the "Tween" object that represents the playback of this interpolation local tween = TweenService:Create(THEPART,tweenInfo,Properties) -- Play the interpolation: tween:Play()
and by that you can easily figure out how to move your model using primarypart.