I am not able to freeze the player for my elevator

Here is the script

local TweenService = game:GetService("TweenService")
local Elevator = game.Workspace.Elevator
local TweenInfo = TweenInfo.new(20, Enum.EasingStyle.Quart,
                                Enum.EasingDirection.InOut)
local UPElevator = TweenService:Create(Elevator, TweenInfo, {
    ["Position"] = Vector3.new(-108.728, 629.754, 14.857)
})
local DownElevator = TweenService:Create(Elevator, TweenInfo, {
    ["Position"] = Vector3.new(-108.728, 1.854, 14.857)
})

local PlayerPartTable = {}

Elevator.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        table.insert(PlayerPartTable, part)
    end
end)

Elevator.TouchEnded:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        table.remove(PlayerPartTable, table.find(PlayerPartTable, part))
    end
end)

while true do
    task.wait(5)
    for _, v in pairs(PlayerPartTable) do
        v.Anchored = false
        local Weld = Instance.new("Weld", v)
        Weld.Part0 = v
        Weld.Part1 = Elevator
    end
    DownElevator:Play()
    task.wait(20)
    task.wait(10)
    UPElevator:Play()
    task.wait(20)
end

But in game the player is welded like that

The elevator is a union part and look like that

Thank you !

Im new to Roblox Dev forum Try using platformStand = true when player touches Elevator Union Set player platformStand = true (i never coded sorry) (also im not english)

You could try using a WeldConstraint rather than a weld, it may sort the positioning issue you have.

https://developer.roblox.com/en-us/api-reference/class/WeldConstraint

The WeldConstrait saddly don’t follow the Tween.

I’ve never experimented much with Welds as I tend to use WeldConstraints more often, however you could try setting both the C0 and C1 attributes of the weld. This is an example on the wiki

weld.Part0.CFrame * weld.C0 = weld.Part1.CFrame * weld.C1

Your code don’t work, because it don’t really mean anything :confused:

I wasn’t giving you the code for your problem. I was giving the example included within the roblox wiki. Here’s the page.

https://developer.roblox.com/en-us/api-reference/class/Weld

Well I think I will use WeildConstraint but do you know how to make it in order that it follow the part ?

Problem Solved :white_check_mark: !

It seems that WeildConstraint only follow the Tween if you are using CFrame instead of Position !