This is the locomotive in proper working order.
Using PivotTo() to spawn it at a distant location causes the weld to break.
Is there a way to fix this?
Or is it due to a floating-point error and therefore unfixable?
script.Parent.MouseClick:Connect(function()
local clone = workspace.Loco:Clone()
clone:MoveTo(script.Parent.Parent.Parent.SpawnBase.CFrame)
clone.Parent = workspace
end)
local PrimaryPart = script.Parent.PrimaryPart
local Parts = script.Parent:GetChildren()
for i = 1, #Parts do
if Parts[i]:IsA("BasePart") then
local weld = Instance.new("Weld")
weld.Part0 = PrimaryPart
weld.Part1 = Parts[i]
weld.C0 = PrimaryPart.CFrame:inverse()
weld.C1 = Parts[i].CFrame:inverse()
weld.Parent = PrimaryPart
end
end

