Background moving train

Just so you know, doing this will not work, because setting the primary part’s position only changes the primary part’s position.

You should to use this method (albeit outdated), because it would take significantly longer to rig the train.

@Edison20020216, here’s some food for thought.

local TweenService = game:GetService("TweenService")

local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = Train:GetPrimaryPartCFrame()

local tween = TweenService:CreateTween(CFrameValue, TweenInfo.new(10, Enum.EasingStyle.Linear), {Value = endCFrame}) -- make sure to define endCFrame

CFrameValue.Changed:Connect(function()
	Train:SetPrimaryPartCFrame(CFrameValue.Value)
end)

tween:Play()

tween.Completed:Wait()
CFrameValue:Destroy() -- does garbage collection for changed on destroy

If you don’t feel comfortable using this method, then you can use the more updated version of @PostApproval’s model tweening method:

4 Likes

It is so complicated, my mind is hurt while reading this, I will see if I understand how it work when I get back on to the studio later. Thank you for your help.

1 Like

To select the primarypart do this:

1- Go to the properties of the model of your train.
2- Click on PrimaryPart, if it has already then leave it like that.
3- Go to explorer and click a part, to select the primarypart, i recommend you the front part.

That’s it.

1 Like

You dont need primary part for this, you need any part, welded to all others

Incorrect Answer

@mistr88 Nope, welds break whenever you apply positional changes or cframe changes. That doesn’t change anything.

Welds do NOT break whenever you apply positional changes as long as they’re WeldConstraints. ManualWelds do break when that happens.

It’s not. Basically, it tweens the CFrame value, and when it’s changed it sets the primary part’s cframe. Nothing complicated at all.

Really, i made background car system, by moving welded model
and this is also based on moving welded models

No, no, noooooooo, this is looping every child of it, i have expirence with this.

I already suggested the resource. It takes quites some time to rig an entire train. That’s why I suggested the old one first.

That’s how it’s supposed to work. It works relative to the PrimaryPart, yes it has bugs, thus why I suggested the other resource.

1 Like

You can actually move and rotate a model using CFrame even if there are WeldConstraints in its parts. An alternative way to SetPrimaryPartCFrame would be to directly change the CFrame of a random part of the model, which would have to be anchored and welded to the other parts (welding is not disabled).

Yes, that will work. However, using normal welds will in fact break it.

I completely forgot about weld constraints, and I should’ve remembered to tell him to anchor it. All of this stuff should work if this is the case.

As a sidenote, I typically don’t use WeldConstraints, because I’m used to using the typical Welds. I’m also worried that it won’t break joints when an explosion hits it like a normal weld.

2 Likes
4 Likes