Proximity Prompt Release

What is a ProximityPrompt?

ProximityPrompt is a method to prompt users and allow them to interact with an object in the 3D world, such as opening a door or picking up an item. This is a system that developers have been writing on their own, but we wanted to make it easy for devs, and also have a universal system across roblox, so players easily understand how to interact with objects.

Using this new feature you can:

  • Indicate what objects can be interacted with in the world
  • Display what action(s) can be taken on the object
  • Trigger that action(s) through user input
  • Display the correct input for all input types (keyboard/gamepad/touchscreen)
  • Use a tap to instantly trigger the action, or a hold to trigger the action over a period of time
  • Use the default UI provided or add your own custom UI

8afa4f18eca1913a6efe812d784e82dd

How do I use it?

Create an object of type ProximityPrompt in the workspace as a child of a part, model, or attachment. Modify any properties as desired, such as ActionText and KeyboardKeyCode to adjust how the prompt looks or which button the user must press to interact with it.

In order to detect when the user interacts with the object, listen for the Triggered event on the ProximityPrompt in either a Script or LocalScript, as in this simple example:

workspace.Part.ProximityPrompt.Triggered:Connect(function(player)
    print("The user interacted with me!")
end)

Launch the game in Studio, and walk over to where the prompt was placed in the world. You will be able to see the UI, and you should be able to interact with it by pressing the E key by default (or whatever you changed KeyboardKeyCode to).

Use Cases

  • Tap button to interact - pick up an object, open a door, flip a switch, talk to NPC.

  • Hold button to trigger immediate action - require player to hold button for X seconds before picking a lock or opening a chest, which leaves the player exposed. HoldDuration is a useful property that, if non-zero, will require the player to hold the button down for a duration before the action is triggered. A progress bar animation indicates how long the button needs to be held.

  • Hold button for continuous action - player holds button to heal a teammate or water a plant over time. The action continues while the button is held and stops when the button is let go. “Hold” events are supported. Use the TriggerEnded event along with Triggered for this scenario. (Triggered and TriggerEnded events always come in pairs.)

A tutorial on how to use the feature can be found here:

Proximity Prompt Tutorial

Complete documentation is available here, including the list of properties you can change, and a method to fully customize your prompts.

ProximityPrompt Documentation

ProximityPromptService Documentation

601 Likes

Can we listen for proximity prompts that require a direction? e.g. forcing a First Person View player to look at an object in order to use it’s ProximityPrompt?

Use cases: Defusing a bomb, placing a trap, Among Us style tasks

25 Likes

Can we use custom GUIs or make the prompt appear as a GUI instead of being ontop of the part were interacting with?

11 Likes

For now I believe this article will answer your question:

Edit: It’s pretty self explanatory eh?
https://developer.roblox.com/en-us/articles/proximity-prompts

4 Likes

It is answered on the DevHub post:

1 Like

For now I think you can just use an invisible custom UI, and listen for the PromptShown/PromptHidden events to show the real one on screen.

3 Likes

It isn’t answered directly, but here it is:

10 Likes

I’m not too sure if that feature is completely modular as it literally just came out. What I’ll do for now is to attempt to override the main GUI (CoreScripts or CoreGUI??) by just literally making that GUI invisible.

Easier said than done if it’s a core script, but I believe ROBLOX will provide more modularity somehow in the future. You ain’t the only one waiting eh?

3 Likes

I think you misunderstood, I meant like I want a custom screengui not the billboard one that comes with it.

5 Likes

Yeah definitely not I hope they get some support for custom GUIs ASAP.

5 Likes

Oh, that’s answered on the Beta announcement. Here it is:

And also in this same post lol:

2 Likes

Well that solves that, thanks.
Edit:
I am clearly blind…

1 Like

Thanks for the interest in the feature!
The documentation here should be able to point you in the right direction for customizing the GUI:

15 Likes

Will there ever be a way for us to generate circles with different widths like in this Instance? Recreating the GUI for ProximityPrompts is currently not possible with the features Roblox is offering. Instead, the only (pretty improper) way of doing this is by either creating hundreds of images and looping through them or making hundreds of Frame instances.

2 Likes

Im pretty sure theres a devforum post on this somewhere let me see if I can find it.

We will get that fixed shortly, thanks for pointing this out!

6 Likes

Are there any performance implications? Do you think this is a better way (as in performance wise in general) than doing it from scratch?

Overall, this is a great feature, I hope you all add more features like these!

Heres a module

2 Likes

I know that it is possible, and I pointed out the ways of doing it. As my reply says, I’m asking whether we will ever get support of doing this properly, not in (kind of) hacky ways like it is done now.

3 Likes

Hmm… There isn’t a prompt:
image

Setup:
image

local proximityPrompt = script.Parent.ProximityPrompt
local seat = script.Parent

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if seat.Occupant then
		proximityPrompt.Enabled = false
	else
		proximityPrompt.Enabled = true
	end
end)

proximityPrompt.Triggered:Connect(function(player)
	seat:Sit(player.Character.Humanoid)
end)

Other than that, this is one of my favorite 2020 updates! GG Roblox!

7 Likes