Hello, how do i make a part move to a location using tweenservice? I tried to use Cframe but it is not smooth and i have seen a tutorial but its only for parts.
✓ ANSWER ACCEPTED
How to move a model using TweenService?
1 answer
✓ Accepted answer
If you want to move a model with TweenService, you can create a dummy CFrameValue, tween its value, and call SetPrimaryPartCFrame() on the model in the Changed event of the value.
Example:
local cfv = Instance.new("CFrameValue", model)
cfv.Value = model.PrimaryPart.CFrame
local function Tween(obj, t, properties) --my tween function, feel free to change it
local TweenService = game:GetService("TweenService")
local ti = TweenInfo.new(t, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tween = TweenService:Create(obj,ti,properties)
tween:Play()
return tween
end
cfv.Changed:Connect(function(val)
model:SetPrimaryPartCFrame(val) --change the cframe of the model each time the CFrameValue changes
end)
Tween(cfv, 3, CFrame.new(20,0,0)) --change with your desired time and position
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Instance.new("class",parent) is deprecated. use local obj = Instance.new("class") obj.Parent = parent
Idc, it's deprecated because it's slow when creating objects updated by the physics engine. CFrameValue isn't one of them, so it's techncially faster to use the 2nd argument in this case, because not invoking __newindex is one less function call.
https://wiki.roblox.com/index.php?title=Instance_(Data_Structure) also: https://devforum.roblox.com/t/psa-dont-use-instance-new-with-parent-argument/30296 I just wanted to show the links