I am having trouble with making a moving model

I am trying to make a model that moves back and fourth, this script works for parts but weirdly not for models. My issue is that it simply isn’t moving at all. What I have tried so far is looking through other scripts that exist and trying to use them to create my desired effect but it has not worked out well for me.

local TweenService = game:GetService("TweenService")
local TweenInfo = TweenInfo.new(
	2, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
	true, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

local Part = script.Parent

local goal = {}
goal.Position = Vector3.new(-81.5, 0.8, -111.3)

local Tween = TweenService:Create(Part, TweenInfo, goal)
Tween:Play()

Typically you need to Weld the Models together to have the Parts stay together when tweening, as you are telling a Single Part to be Interpolated, instead of all Parts within the Model, Which would be a very simple solution, however without Welding, you would Interpolate the Model using either Model:MoveTo() or Model:PivotTo().

Another option would be attaching every part in the model to the primary part with Welds (I recommend using this plugin) and then changing the primarypart cframe since you are tweeting. The welded parts should move with the primary part.

like this:

TweenService:Create(PrimaryPart, TweenInfo.new(1), {CFrame = cframePosition}):Play()

Oh yes thank you!! I didn’t weld the parts together. While you were writing this I did find a different solution but this too is a good solution!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.