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.
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