Why am I not able to weld?

Hello developers,

I made an elevator looks realisic in Roblox, so I found a thing that when I welded the doors manually and unachored it,so it won’t fall when going up and down.The doors are not moving, I tried to change the position manually of the doors to its changing back, then I removed the welding of doors to elevator body.It works pretty good but falls down when going up and down or pushed by player.

So is the issue with the roblox engine of welding or the script:
Here is the script:

local tweenservice = game:GetService("TweenService")
for i,v in pairs(script.Parent:GetChildren()) do
    if v:IsA("Part") then
        v.ClickDetector.MouseClick:Connect(function()
            local elevatormainpart = script.Parent.Parent.Elevator.MainPart
            if v.Name == "Button1" then
                local goalsfor1zero = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2zero = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local infofordoors = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
                local animfor1zero = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1zero)
                local animfor2zero = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2zero)
                animfor1zero:Play()
                animfor2zero:Play()
                local info = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0.25)
                local goals = {
                    CFrame = script.Parent.Parent.Floors:WaitForChild("1").CFrame
                }
                local anim = tweenservice:Create(elevatormainpart,info,goals)
                anim:Play()
                wait(5)
                local infofordoors = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
                local goalsfor1 = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2 = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local animfor1 = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1)
                local animfor2 = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2)
                animfor1:Play()
                animfor2:Play()
                wait(2)
                local goalsfor1two = {
                    CFrame = script.Parent.Parent.Elevator.Door1Close.CFrame
                }
                local goalsfor2two = {
                    CFrame = script.Parent.Parent.Elevator.Door2Close.CFrame
                }
                local animfor1two = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1two)
                local animfor2two = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2two)
                animfor1two:Play()
                animfor2two:Play()
            elseif v.Name == "Button2" then
                local goalsfor1zero = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2zero = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local infofordoors = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
                local animfor1zero = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1zero)
                local animfor2zero = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2zero)
                animfor1zero:Play()
                animfor2zero:Play()
                local info = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0.25)
                local goals = {
                    CFrame = script.Parent.Parent.Floors:WaitForChild("2").CFrame
                }
                local anim = tweenservice:Create(elevatormainpart,info,goals)
                anim:Play()
                wait(5)
                local infofordoors = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
                local goalsfor1 = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2 = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local animfor1 = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1)
                local animfor2 = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2)
                animfor1:Play()
                animfor2:Play()
                wait(2)
                local goalsfor1two = {
                    CFrame = script.Parent.Parent.Elevator.Door1Close.CFrame
                }
                local goalsfor2two = {
                    CFrame = script.Parent.Parent.Elevator.Door2Close.CFrame
                }
                local animfor1two = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1two)
                local animfor2two = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2two)
                animfor1two:Play()
                animfor2two:Play()
            elseif v.Name == "Button3" then
                local goalsfor1zero = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2zero = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local infofordoors = TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0)
                local animfor1zero = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1zero)
                local animfor2zero = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2zero)
                animfor1zero:Play()
                animfor2zero:Play()
                local info = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,false,0.25)
                local goals = {
                    CFrame = script.Parent.Parent.Floors:WaitForChild("3").CFrame
                }
                local anim = tweenservice:Create(elevatormainpart,info,goals)
                anim:Play()
                wait(5)
                local goalsfor1 = {
                    CFrame = script.Parent.Parent.Elevator.Door1Open.CFrame
                }
                local goalsfor2 = {
                    CFrame = script.Parent.Parent.Elevator.Door2Open.CFrame
                }
                local animfor1 = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1)
                local animfor2 = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2)
                animfor1:Play()
                animfor2:Play()
                wait(2)
                local goalsfor1two = {
                    CFrame = script.Parent.Parent.Elevator.Door1Close.CFrame
                }
                local goalsfor2two = {
                    CFrame = script.Parent.Parent.Elevator.Door2Close.CFrame
                }
                local animfor1two = tweenservice:Create(script.Parent.Parent.Elevator.Door1,infofordoors,goalsfor1two)
                local animfor2two = tweenservice:Create(script.Parent.Parent.Elevator.Door2,infofordoors,goalsfor2two)
                animfor1two:Play()
                animfor2two:Play()
            end
        end)
    end
end

And there is no error in the script, I’ve checked the output thrice.

hello does anyone know xd its been 30 mins

1 Like

Wait, I’m reading the script…

ok sorry, its hard to read its messed up xd

Sorry but i can’t help, I can’t event find the welds in this

no I did not use script to weld, I welded it manually sir

but the doors are not moving when I welded, can welds stop changing of position of doors

Why even tween the doors open? Using motors is much more efficient.

1 Like

motors? how do u motors to open doors its sliding door

Motor.C0 and Motor.C1. You can basically use for loops to change those values, which are positional values.

correction, not positional, but CFrame values

so welds can stop changing cframe of an object?

image

In this case I would use the PrismaticConstraint | Roblox Creator Documentation to alter the doors positions. If you don’t yet understand constraints yet though you can check out the article Physics | Roblox Creator Documentation.

1 Like

welds hold parts together until the weld itself is destroyed. if the doors are welded, then the doors will not open.

oh ok thank you i will try to use prismatic constrait

oh nice i never know it so i will make another door