Proximity Prompt Door - Open and close a door with Proximity Prompt

Hi! I will be teaching you how to make a door opening and closing using Roblox’s Currently in Beta “Proximity Prompt”.

Whats Proximity Prompt?

The in-beta proximity part allows you to interact with a item as in holding/pressing E to print a message in the Output. For Xbox its X,for mobile you can just hold/tap to do, and for computer you can hold/press E. You can always change the keybinds.

Before starting…

You must have Proximity Prompt Enabled in the beta settings. Please follow the stuff what it does on the screenshots.

Open "File" and press "Beta Settings".
Next press Beta Settings
Now scroll down to “Proximity Prompt Beta” and enable it. It might want you to restart studio.
image

You are done getting ready.

Open a baseplate or any thing.

Make a Part and size it how ever you like. Name it door after


Add a proximity prompt to the door model/part.
image
Now set the properties to this:

HoldDuration: How long you have to hold to interact. 0 for just tap.
GamepadKeyCode: For Xbox users they have to press X to interact
KeyboardKeyCode: What key for PC users have to press in-order to interact.
MaxActivationDistance: How far you can interact.

^^^ If you want, only edit those. Do not edit other properties.

Add a script into the Proximity Prompt. You may edit the scripts name if you would like to.
image
Write this into it or Copy And Paste

Script

local ProximityPrompt = script.Parent
local Door = script.Parent.Parent

ProximityPrompt.Triggered:Connect(function()
if ProximityPrompt.ActionText == “Open” then
Door.Transparency = .5
Door.CanCollide = false
ProximityPrompt.ActionText = “Close”
else
Door.Transparency = 0
Door.CanCollide = true
ProximityPrompt.ActionText = “Open”
end
end)

Script end

After this you should be able to open and close your door.
The script may fail if the door is not achored.

4 Likes