Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sliding door wont work correct when its a union instead of a part?

When I use this script it works well on a singular part door but when I make it a union it goes forward and backward instead of working how it did before I have tried editing the script over and over and I still can't make it work as it should here is the script :

open = false

door1 = script.Parent.Parent.Parent.Door1

door2 = script.Parent.Parent.Parent.Door2

 

local TweenService = game:GetService("TweenService")

local part = script.Parent

 

local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

 

local Door1Open = {CFrame = door1.CFrame + door1.CFrame.lookVector * -2}

local Door2Open = {CFrame = door2.CFrame + door2.CFrame.lookVector * 2}

local Door1Close = {CFrame = door1.CFrame }

local Door2Close = {CFrame = door2.CFrame }

 

local Open1 = TweenService:Create(door1,tweenInfo,Door1Open)

local Open2 = TweenService:Create(door2,tweenInfo,Door2Open)

local Close1 = TweenService:Create(door1,tweenInfo,Door1Close)

local Close2 = TweenService:Create(door2,tweenInfo,Door2Close)

 

script.Parent.MouseClick:connect(function()

if open == false then

Open1:Play()

Open2:Play()

wait(2)

open = true

else

Close1:Play()

Close2:Play()

wait(2)

open = false

end

end)

2 comments

0

Formatting please

0

Are u getting an error? also in the future you may want to post the code in appropriate format

1 answer

✓ Accepted answer

Answer: Your part's orientation changed when you created the union, along with the surfaces.

How to fix: When you create a union, the first part you select determines how the bounding box is placed. Which may be the orientation as well. So just make sure you have a perfectly oriented part with no rotations and the right directions as your first selection before you do a union.

This person had the same problem as you.

This discussion is preserved as it was. New answers, comments, and votes are closed.