Tween Move issue

  1. What do you want to achieve? So I want to make a moving Model using tween
  2. What is the issue? The tween works although it moves everything to the exact position.

Hello what I’m trying to do is tween a model to make it move but everything is working the only problem is it moves everything to the the exact position. The position I put for it to go I just want that to be like the end position but I don’t want it to move like it does here’s a screenshot of before and after.

And Yes the boat is welded


local chil  = script.Parent:GetChildren()

for i, v in pairs(chil) do 
	if v:IsA("MeshPart") or  v:IsA("BasePart") then
		local root = v
local tweenservice = game:GetService("TweenService")
local Time = 20
local tweenInfo = TweenInfo.new(
	Time,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

		local properties = {Position = Vector3.new(-13.832, 93.441, 8465.132)}

local tween = tweenservice:Create(root,tweenInfo,properties)

tween:Play()
	end
end ```

That’s because you are moving all the parts in the model to that position. You may be better off making your own tween using SetPrimaryPartCFrame [Model | Roblox Creator Documentation] to loop the Model somewhere, as using Tween will require you to set a specific position for each part.

1 Like

How can I fix that?


for i, v in pairs(chil) do 
	if v:IsA("MeshPart") or  v:IsA("BasePart") then
		local root = v
local tweenservice = game:GetService("TweenService")
local Time = 20
local tweenInfo = TweenInfo.new(
	Time,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

		local properties = {Position = Vector3.new(-13.832, 93.441, 8465.132)}

local tween = tweenservice:Create(root,tweenInfo,properties)

tween:Play()
	end
end

See Introduction to Tweening Models

Uh, I don’t think what your doing is efficient, plus hard to do with tweening so ima use lerping instead…
What @sloss2003 said was you could just move the whole model instead of having to move every individual MeshPart or BasePart in the model.

So just define the model and lerp using the model cframes…

local model = workspace.Model -- Yeah the model
for i=1,10,1 do
    local cframe = model.PrimaryPart.WorldCFrame
    local newframe = cframe:lerp(cframe*CFrame.new(0,0,-10),i/10)
    model:SetPrimaryPartCFrame(newframe)
    wait(.5)

Note: I’m unsure if this is the best way to do this but is worth a try for your use case… GL

Im trying your solution but : image

for i=1,10,1 do
		local cframe = model.PrimaryPart
	local newframe = cframe:lerp(cframe*CFrame.new(0,0,-10),i/10)
	model:SetPrimaryPartCFrame(newframe)
	wait(.5)
end

You wrote it up wrong…

This should be
local cframe = model.PrimaryPart.WorldCFrame

P.S Sorry I don’t have notifications turned on so wasn’t notified…

1 Like

Another error take a look image

Well again my bad just change WorldCFrame to CFrame, roblox started using something called WorldCFrame, so I thought it would work in this case…

I suggest just welding everything then tweening the primarypart CFrame, but if you don’t want and you just have to move the boat in straightline you could do is increment their Position ex: Tween:Create(v, TweenInfo, {Position = v.Position + Vector3.new(0,0,100)}):Play()