How do I make a proximity prompt door?

I want to make a door (part) where if you hold E (proximity prompt) it opens, and automatically closes after like 15 seconds, I just want it simple as I don’t want there to be any movement or anything to the door (part), just that it becomes semi-transparent and you can go through it for 15 seconds before it automatically closes again. How do I make that?

You make an effort to do that.

1 Like

I wouldn’t have asked if I didn’t get stuck on it after trying multiple times lol.

I’m still a beginner at scripting so yea it might seem easy for most but it isn’t for me.

2 Likes

My apologies for being careless. I recommend you practice coding more as it is a cool skill. Here is a place and I file with the code for the door. Enjoy and practice!

Door.rbxl (30.8 KB)
Door.rbxm (4.6 KB)

3 Likes

No worries, thank you!

Also, I forgot to mention I want it to work only for one player and not the others on the server, (I hope I’m not wrong) I just need to make the script a local script, right?

Yup! (Well sorta) Here are the files!
ClientDoor.rbxl (31.9 KB)
ClientDoor.rbxm (5.7 KB)

Take a look at these articles while you’re at it!
https://developer.roblox.com/en-us/articles/proximity-prompts

https://developer.roblox.com/en-us/onboarding/intro-to-studio/2

https://developer.roblox.com/en-us/articles/Loops

2 Likes

You could make it on server and check if the player you want authorized is the one that trigerred the prompt. ProximityPromptService.PromptTrigerred as I remember returns both prompt and player who trigerred.

2 Likes

Thank you so so much!! this is gonna help me learn a lot!

1 Like

Thank you very much for the advice as well! I’ll read more into it and learn about it.

Yes. It does,

script.Parent.Triggered:Connect(function(playerTriggered)
	print(playerTriggered)
end)

image

2 Likes
local prompt = script.Parent
local door = prompt.Parent

local whiteListedIds = {1, 2, 3, [[your ID here]]}

prompt.Triggered:Connect(function(player)
	if table.find(whiteListedIds, player.UserId) then
		door.CanCollide = false
		door.Transparency = 1
	else
		door.CanCollide = true
		door.Transparency = 0
	end
	task.delay(15, function()
		door.CanCollide = true
		door.Transparency = 0
	end)
end)
2 Likes