The train in the picture is weldconstrainted to the red part (every part is unanchored). The train slowly tilts as the train turns the bends.
I don’t know why this is happening, here’s the code:
local function Update()
for i,v in pairs(rightmotors) do
v.AngularVelocity = vel
end
for i,v in pairs(leftmotors) do
v.AngularVelocity = -vel
end
for i,v in pairs(mains) do
v.Orientation = Vector3.new(v.Orientation.X,v.Orientation.Y,0)
v.AssemblyLinearVelocity = v.AssemblyLinearVelocity.Unit * vel
v.AssemblyLinearVelocity = Vector3.new(v.AssemblyLinearVelocity.X,-1,v.AssemblyLinearVelocity.Z)
end
for i,v in pairs(cars) do
TS:Create(v.Build.Main,info,{CFrame = v.Chassis.WheelSetFront.Connector.CFrame:Lerp(v.Chassis.WheelSetBack.Connector.CFrame,0.5)}):Play()
--v.Build.Main.CFrame = v.Chassis.WheelSetFront.Connector.CFrame:Lerp(v.Chassis.WheelSetBack.Connector.CFrame,0.5)
end
end
Please help!