Tweening a model

Hi, I am trying to tween a car to point b, but it’s only tweening the primary part, not the model itself. How would I do that?

local TweenService = game:GetService("TweenService")


local tweenInfo = TweenInfo.new(
	2, -- The time the tween takes to complete
	Enum.EasingStyle.Linear, -- The tween style.
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
	false, -- Reverse?
	0 -- Delay
)

while true do
	local Car = game.ServerStorage.CarProps.Car:Clone()
	Car.Parent = game.Workspace
	
	Car.PrimaryPart.CFrame = game.Workspace.Route1Drive.Start.CFrame * CFrame.new(0,1,0)
	
	local Tween = TweenService:Create(Car.PrimaryPart, tweenInfo, {CFrame = game.Workspace.Route1Drive.End.CFrame}) -- Creates the tween with the TweenInfo and what properties you want to change
	Tween:Play()
	
	wait(2)
	
	Car:Destroy()
	
	wait(5)
end

Setprimarypartcframe

This will move the entire model. To tween it, you would have to make your own function but you can tween a CFrame value and apply it to the model. This can be a performance impact so you should try to tween it on all the clients and then once the tween is done, set the cframe on the server at the destination

Or you can weld it but Im quite sure this is something that can cause problems if not done properly

1 Like