does it work with the other door?
After doing some changes, It works for both doors, thanks so much!
Code I Ended up with (This is test code, I have many doors, but I was just seeing what needed to be done to make it work!) :
local originalDoor1Z = game.Workspace.RepellingDoors.LeftDoor1:GetPivot().Position.Z
local originalDoor2Z = game.Workspace.RepellingDoors.LeftDoor2:GetPivot().Position.Z
local function SlideDoors(DoorNeededToSlide, door)
if DoorNeededToSlide.Name == "LeftDoor1" then
local cframe : CFrame = CFrame.new(DoorNeededToSlide:GetPivot().Position.X, DoorNeededToSlide:GetPivot().Position.Y, originalDoor1Z- door.DragDetector.DragFrame.Z)
DoorNeededToSlide:PivotTo(cframe * CFrame.Angles(0,math.rad(-90), math.rad(90)))
else
local cframe : CFrame = CFrame.new(DoorNeededToSlide:GetPivot().Position.X, DoorNeededToSlide:GetPivot().Position.Y, originalDoor2Z + door.DragDetector.DragFrame.Z)
DoorNeededToSlide:PivotTo(cframe * CFrame.Angles(0,math.rad(270), 0))
end
end
game.Workspace.RepellingDoors.LeftDoor2.DragDetector.DragContinue:Connect(function()
SlideDoors(game.Workspace.RepellingDoors.LeftDoor1, game.Workspace.RepellingDoors.LeftDoor2)
end)
game.Workspace.RepellingDoors.LeftDoor1.DragDetector.DragContinue:Connect(function()
SlideDoors(game.Workspace.RepellingDoors.LeftDoor2, game.Workspace.RepellingDoors.LeftDoor1)
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.