Help with welding a model to another model running an animation

Hello there, I am making an elevator drop ride, which has two loading floors which push a carriage into the elevator. I am using animations to move the elevator by having one Motor6D between a anchored RootPart and the bottom part of the elevator and then having the animations move linear. The zero of the Motor6D in relation with the elevator is on the upper loading floor.

I am wanting to achieve having the carriage models weld to the elevator when they are pushed into the elevator, which works on the upper loading floor, however the issue I am having is welding the lower loading floor’s carriage to the elevator. When the elevator is at the bottom loading floor, it has an idle animation for that floor that loops, and then when it creates the weld with the carriage, the carriage jumps down an entire floor as if the physics engine still believes the elevator is at the upper loading floor when it creates the weld.

Here is a video that shows what it should do from the upper loading floor:


And this is what happens on the lower loading floor:

I have tried so far having the carriage anchor when it welds and having the elevator anchor when it welds, but that doesn’t solve it. I can not find anything similar on the Developer Hub and I would rather not have to move the root part for the bottom loading floor.

Here is the code for it moving to the lower loading floor. The upper loading floor is labeled as B1 and the lower loading floor is labeled as B2

local LoadAnimation = require(game.ServerScriptService.LoadAnimation)
local Shared = require(game.ServerScriptService.IdleAnims)
local AnimTrack = LoadAnimation(4842140701, script.Parent.Parent.Elevator.Bottom) --This plays the animation to transfer from B1 to B2
AnimTrack:Play(0)
AnimTrack.Stopped:Wait()
Shared.IdleAnimation = LoadAnimation(4842142754, script.Parent.Parent.Elevator.Bottom) --This plays the idle animation at B2
Shared.IdleAnimation:Play()
script.Parent.Parent.B2Doors.Open.Value = true
script.Parent.Parent.B2Ready.Value = true

This is the script that welds the carriage to the elevator.

local carriagepiece = script.Parent.Parent.Parent.Carriage.Model.Side1.BottomPiece
local attach = script.Parent.Parent.Attacher
local pris = script.Parent.PrismaticConstraint
local anchors = script.Parent.Parent.Parent.Carriage.Model.Back
repeat wait(0.5) until pris.CurrentPosition >= 21.5
wait(1)
local weld = Instance.new("WeldConstraint")
weld.Part0 = anchors
weld.Part1 = script.Parent.Parent.Parent.Parent.Elevator.Bottom.Bottom
weld.Parent = script.Parent.Parent.Parent.Parent.Elevator
weld.Name = "ElevatorCarriageWeld"
attach.PrismaticConstraint.Enabled = false
pris.Speed = 3
pris.TargetPosition = 16
wait(1)
script.Parent.Clear.Value = true

Thanks.