How can I make a door open both ways?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?

I want to make a door open both ways depending on which side you are on

  1. What is the issue?

I am not quite sure how to achieve this, I am also a beginning scripter so I am looking for a bit of guidance/help :smiley:

  1. What solutions have you tried so far?

I have tried going on YouTube, and looking on here and I have not found anything I am trying to look for

1 Like

Did you solve the problem? If not, do you have a functional door that works on one side? i’d like to see the script.

–THIS TUTORIAL IS FOR PROXIMITY PROMPT DOORS

The door should be attached to another object which, let’s call it “Hinge”, In the script you need to use “TweenService” so Hinge moves, and make another object (we are going to call it “front door”) that is attached to Hinge move via a WeldConstraint, if you have a functional door that works on one side, you could try implementing another object like door but with a different name (“back door” could be), you need to attach it to Hinge via a WeldConstraint.

Next step is make the local for back door and the prompt for it, example of my door:

local frontdoor = script.Parent.frontdoor
local hinge = script.Parent.hinge
local frontprompt = frontdoor.ProximityPrompt

local backdoor = script.Parent.backdoor
local backprompt = backprompt.ProximityPrompt

Here’s the TweenService usage i did:

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(-90), 0) -- The -90 is the Rotation degree, change it to your preference.

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0) -- This is the position that it's gonna acquire when closing; everything is at 0 so it returns to its original position.

local tweenInfo = TweenInfo.new(0.75) -- This the time it's gonna take to open or close
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)

You’re gonna need to make a local function so Front and Back sync:

local isOpen = false

local function Syncprompts(actiontext)
frontprompt.Actiontext = actiontext
backprompt.Actiontext = actiontext

Now you’re gonna need to use the backprompt and frontprompt:

frontprompt.Triggered:Connect(function()
    if IsOpen then
    tweenClose:Play()
    isOpen = false
    Syncprompts("Open") -- Change this to the text you want; this is the text that it's going to show on the object that the ProximityPrompt is in when the door is Closed.
else
    tweenOpen:Play()
    isOpen = true
    Syncprompts("Close") -- Change this to the text you want; this is the text that it's going to show on the object that the ProximityPrompt is in when the door is Open.
    end
end)

backprompt.Triggered:Connect(function()
   if IsOpen then
   tweenClose:Play()
   isOpen = false
   Syncprompts("Open")
else 
   tweenOpen:Play()
   isOpen = true
   Syncprompts("Close")
   end
end)

Hope this helped, if this didn’t help you, try sending me the code and i would mind checking it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.