How can I use a single script to control multiple doors with a proximity prompt in each?

I would like to control multiple doors with one or two scripts. It’s a single-player game and each door is controlled with a proximity prompt. How can I use the single script to make each proximity prompt open each individual door it is connected to? The doors also open using a tween (unless if there’s another way).

image

1 Like

Basically I want to check whenever a proximity prompt is triggered anywhere to find its parent and play an animation.

Ah! ProximityPrompt Service is what you need: here

2 Likes

THANK YOU SOO MUCH. IT WORKS NOW!

i did this:

local ProximityPromptService = game:GetService(“ProximityPromptService”)
local function onPromptTriggered(promptObject, player)
–Code
end
ProximityPromptService.PromptTriggered:Connect(onPromptTriggered)

and i just get the parent of the object and make it open.

2 Likes

Absolutely! you got this under control already haha good job

Now I gotta find a way of making doors open to the side no matter how they are rotated XD

1 Like

This will help you with that!