Why isn't my model moving at all (TWEEN)

I want to make a train cart that moves across the map on a railroad


There are no errors, the cart does not move
All the parts in the cart are welded to the primary part
No parts are anchored
If I remove the railroad or move the cart higher, no difference is made

Here is the script:

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(120,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local primary = script.Parent.PrimaryPart
local goal1 = {
	CFrame = primary.CFrame * CFrame.new(-629.5, -0.5, -1816.5)
}
local goal2 = {
	CFrame = primary.CFrame * CFrame.new(2856.5, -0.5, -1816.5)
}
local tween1 = ts:Create(primary,ti,goal1)
local tween2 = ts:Create(primary,ti,goal2)

while true do
	tween1:Play()
	tween1.Completed:Wait()
	tween2:Play()
	tween2.Completed:Wait()
end

There are no errors
I have put prints in between where the loop starts, where the tween is played and completed, and they both print properly, but nothing actually happens

What am I doing wrong?

1 Like

Does this work?

local ts = game:GetService("TweenService")
local ti = TweenInfo.new(120,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut)
local primary = script.Parent.PrimaryPart
local goal1 = {
	CFrame = CFrame.new(-629.5, -0.5, -1816.5)
}
local goal2 = {
	CFrame = CFrame.new(2856.5, -0.5, -1816.5)
}
local tween1 = ts:Create(primary,ti,goal1)
local tween2 = ts:Create(primary,ti,goal2)

while true do
	tween1:Play()
	tween1.Completed:Wait()
	tween2:Play()
	tween2.Completed:Wait()
end
1 Like

No, I had it like that before I made the post and found something and changed it to what I have now because that didn’t work, thanks for trying tho

It should work, try anchoring the model’s parts

You can’t tween only the PrimaryPart of a model, and have it all move. You can either tween each piece individually, or you can tween the PrimaryPart, and have all parts unanchored and welded to it.

1 Like

I am tweening the primary part and they are all unanchored and welded to it lol

They said in the post that all the other parts are unanchored and welded to the primary part.

Anyway, this issue makes zero sense (I don’t understand why it isn’t working), but I do wonder if just the primary part is actually moving.

If I anchor the parts only the primary parts move, because the welds work with active physics, aka unanchored parts

It is, but everything else isn’t moving with it, when I take everything away it moves fine but when I add everything to the primary part again it does nothing

Dang, I completely missed that. Can you see if the PrimaryPart is moving?
CFrame = primary.CFrame * CFrame.new(-629.5, -0.5, -1816.5)
Can you just set the goal CFrame to the End? CFrame.new(Vector3.New(5,5,5))

I hate to say it, but that sounds like the other parts aren’t actually unanchored. Could you double-check?

It should work. Use this Weld Plugin and select the primary part and then all parts you want to weld, then click the Instant Weld button. Leave the primary part anchored but other parts unanchored

The primary part moves when it’s the only thing in the model
Also the variable goal2 is the end, the variable goal1 is the start

Lol thats the plugin I used to weld it

Idk if this proves it but they are most definitely not anchored

Select the primary part, then select everything else and click the Instant Weld button. Then, you want to make sure the primary part is anchored and everything else isn’t. It should work afterwards.

REMEMBER TO ANCHOR YOUR PRIMARY PART ONLY!!

I anchored the primary part and it seems to work, except that it’s going the wrong way

I think it might because I used * CFrame instead of set

Could you try setting your goal and start locations without the multiplication thing, and just define where you want it to go?

local goal1 = {
	CFrame = primary.CFrame * CFrame.new(-629.5, -0.5, -1816.5)
}
local goal2 = {
	CFrame = primary.CFrame * CFrame.new(2856.5, -0.5, -1816.5)
} 

to this

local goal1 = {
CFrame = CFrame.new(-629.5, -0.5, -1816.5)
}
local goal2 = {
CFrame = CFrame.new(2856.5, -0.5, -1816.5)
}

Would that still work?

Thank you for telling me to anchor the primary part, that was all I needed, thx

By wrong way, do you mean the entire thing is going backwards?