ProximityPrompt
An object that lets you prompt players to interact with an object in the 3D world.
Memory category | Instances |
---|
Member index 26
Description
The ProximityPrompt instance lets you prompt players to interact with an object in the 3D world, such as opening a door or picking up an item. A ProximityPrompt object works when parented to a BasePart, Attachment, or Model (with PrimaryPart set) in the workspace. When the player's character approaches, a UI appears to prompt them for input.
Prompts consist of three primary elements, each of which can be controlled by the noted properties. The default UI can be swapped out for your own custom appearance as outlined in Style.
Property | Description | Default |
ObjectText | An optional name for the object being interacted with. | |
ActionText | An optional action name shown to the player. | Interact |
KeyboardKeyCode | The keyboard key which will trigger the prompt. | E |
GamepadKeyCode | The gamepad button which will trigger the prompt. | ButtonX |
You can connect to proximity prompt events either on the ProximityPrompt object itself or globally through ProximityPromptService. The ProximityPromptService allows you to manage all proximity prompt behavior from one location, preventing any need for duplicate code in your experience.
For more information regarding proximity prompts, see the Proximity Prompts guide.
History 84
- 573 Change ReturnType of InputHoldEnd from void to null
- 573 Change ReturnType of InputHoldBegin from void to null
- 553 Add
- 553 Add
- 553 Add
- 553 Add
- 553 Change Default of UIOffset from to Vector2(0, 0)
- 553 Change Default of Style from to Default
- 553 Change Default of RootLocalizationTable from to
- 553 Change Default of RequiresLineOfSight from to true
- 553 Change Default of MaxActivationDistance from to 10
- 553 Change Default of KeyboardKeyCode from to E
- 553 Change Default of HoldDuration from to 0
- 553 Change Default of GamepadKeyCode from to ButtonX
- 553 Change Default of Exclusivity from to OnePerButton
- 553 Change Default of Enabled from to true
- 553 Change Default of ClickablePrompt from to true
- 553 Change Default of AutoLocalize from to true
- 553 Change Default of ActionText from to Interact
- 486 Change ThreadSafety of UIOffset from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Style from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RootLocalizationTable from ReadOnly to ReadSafe
- 486 Change ThreadSafety of RequiresLineOfSight from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ObjectText from ReadOnly to ReadSafe
- 486 Change ThreadSafety of MaxActivationDistance from ReadOnly to ReadSafe
- 486 Change ThreadSafety of KeyboardKeyCode from ReadOnly to ReadSafe
- 486 Change ThreadSafety of HoldDuration from ReadOnly to ReadSafe
- 486 Change ThreadSafety of GamepadKeyCode from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Exclusivity from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Enabled from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ClickablePrompt from ReadOnly to ReadSafe
- 486 Change ThreadSafety of AutoLocalize from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ActionText from ReadOnly to ReadSafe
- 483 Change Parameters of Triggered from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 483 Change Parameters of TriggerEnded from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 483 Change Parameters of PromptButtonHoldEnded from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 483 Change Parameters of PromptButtonHoldBegan from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 462 Change ThreadSafety of Triggered from to Unsafe
- 462 Change ThreadSafety of TriggerEnded from to Unsafe
- 462 Change ThreadSafety of PromptShown from to Unsafe
- 462 Change ThreadSafety of PromptHidden from to Unsafe
- 462 Change ThreadSafety of PromptButtonHoldEnded from to Unsafe
- 462 Change ThreadSafety of PromptButtonHoldBegan from to Unsafe
- 462 Change ThreadSafety of InputHoldEnd from to Unsafe
- 462 Change ThreadSafety of InputHoldBegin from to Unsafe
- 462 Change ThreadSafety of UIOffset from to ReadOnly
- 462 Change ThreadSafety of Style from to ReadOnly
- 462 Change ThreadSafety of RootLocalizationTable from to ReadOnly
- 462 Change ThreadSafety of RequiresLineOfSight from to ReadOnly
- 462 Change ThreadSafety of ObjectText from to ReadOnly
- 462 Change ThreadSafety of MaxActivationDistance from to ReadOnly
- 462 Change ThreadSafety of KeyboardKeyCode from to ReadOnly
- 462 Change ThreadSafety of HoldDuration from to ReadOnly
- 462 Change ThreadSafety of GamepadKeyCode from to ReadOnly
- 462 Change ThreadSafety of Exclusivity from to ReadOnly
- 462 Change ThreadSafety of Enabled from to ReadOnly
- 462 Change ThreadSafety of ClickablePrompt from to ReadOnly
- 462 Change ThreadSafety of AutoLocalize from to ReadOnly
- 462 Change ThreadSafety of ActionText from to ReadOnly
- 458 Change Parameters of PromptButtonHoldEnded from () to (playerWhoTriggered: Instance)
- 458 Change Parameters of PromptButtonHoldBegan from () to (playerWhoTriggered: Instance)
- 458 Add RootLocalizationTable
- 458 Add AutoLocalize
- 454 Add Triggered
- 454 Add TriggerEnded
- 454 Add PromptShown
- 454 Add PromptHidden
- 454 Add PromptButtonHoldEnded
- 454 Add PromptButtonHoldBegan
- 454 Add InputHoldEnd
- 454 Add InputHoldBegin
- 454 Add UIOffset
- 454 Add Style
- 454 Add RequiresLineOfSight
- 454 Add ObjectText
- 454 Add MaxActivationDistance
- 454 Add KeyboardKeyCode
- 454 Add HoldDuration
- 454 Add GamepadKeyCode
- 454 Add Exclusivity
- 454 Add Enabled
- 454 Add ClickablePrompt
- 454 Add ActionText
- 454 Add ProximityPrompt
Members 26
ActionText
Type | Default | |
---|---|---|
string | Interact |
This property determines the action text shown to the user.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of ActionText from to Interact
- 486 Change ThreadSafety of ActionText from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ActionText from to ReadOnly
- 454 Add ActionText
AutoLocalize
Type | Default | |
---|---|---|
bool | true |
This property determines whether the prompt's ProximityPrompt.ActionText and ProximityPrompt.ObjectText will be localized according to the ProximityPrompt.RootLocalizationTable. When set to true, localization will be applied.
Thread safety | ReadSafe |
---|---|
Category | Localization |
Loaded/Saved | true |
History 4
- 553 Change Default of AutoLocalize from to true
- 486 Change ThreadSafety of AutoLocalize from ReadOnly to ReadSafe
- 462 Change ThreadSafety of AutoLocalize from to ReadOnly
- 458 Add AutoLocalize
ClickablePrompt
Type | Default | |
---|---|---|
bool | true |
This property determines whether the prompt can be activated by clicking/tapping on the prompt's UI. When set to false, the prompt cannot be activated by click/tap except on mobile.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of ClickablePrompt from to true
- 486 Change ThreadSafety of ClickablePrompt from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ClickablePrompt from to ReadOnly
- 454 Add ClickablePrompt
Enabled
Type | Default | |
---|---|---|
bool | true |
This property indicates whether or this ProximityPrompt should be shown.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
Exclusivity
Type | Default | |
---|---|---|
ProximityPromptExclusivity | OnePerButton |
This property is used to customize which prompts can be shown at the same time.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of Exclusivity from to OnePerButton
- 486 Change ThreadSafety of Exclusivity from ReadOnly to ReadSafe
- 462 Change ThreadSafety of Exclusivity from to ReadOnly
- 454 Add Exclusivity
GamepadKeyCode
Type | Default | |
---|---|---|
KeyCode | ButtonX |
This property determines the gamepad button the player should press to trigger the ProximityPrompt. Default is ButtonX.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of GamepadKeyCode from to ButtonX
- 486 Change ThreadSafety of GamepadKeyCode from ReadOnly to ReadSafe
- 462 Change ThreadSafety of GamepadKeyCode from to ReadOnly
- 454 Add GamepadKeyCode
HoldDuration
Type | Default | |
---|---|---|
float | 0 |
This property indicates the duration, in seconds, that the player must hold the button/key down to trigger the prompt.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of HoldDuration from to 0
- 486 Change ThreadSafety of HoldDuration from ReadOnly to ReadSafe
- 462 Change ThreadSafety of HoldDuration from to ReadOnly
- 454 Add HoldDuration
InputHoldBegin
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
This function triggers a signal indicating that the user began pressing the ProximityPrompt prompt button. It should be used by developers who wish to customize the prompt and trigger it from a prompt GUI button press.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of InputHoldBegin from void to null
- 462 Change ThreadSafety of InputHoldBegin from to Unsafe
- 454 Add InputHoldBegin
InputHoldEnd
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
A counterpoint to ProximityPrompt:InputHoldBegin(), this signals that the user ended pressing the prompt GUI button.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of InputHoldEnd from void to null
- 462 Change ThreadSafety of InputHoldEnd from to Unsafe
- 454 Add InputHoldEnd
KeyboardKeyCode
Type | Default | |
---|---|---|
KeyCode | E |
This property determines the key the player should press to trigger the ProximityPrompt. Default is E.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of KeyboardKeyCode from to E
- 486 Change ThreadSafety of KeyboardKeyCode from ReadOnly to ReadSafe
- 462 Change ThreadSafety of KeyboardKeyCode from to ReadOnly
- 454 Add KeyboardKeyCode
MaxActivationDistance
Type | Default | |
---|---|---|
float | 10 |
This property determines the maximum distance a Player's character can be from the ProximityPrompt for the prompt to appear.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of MaxActivationDistance from to 10
- 486 Change ThreadSafety of MaxActivationDistance from ReadOnly to ReadSafe
- 462 Change ThreadSafety of MaxActivationDistance from to ReadOnly
- 454 Add MaxActivationDistance
ObjectText
Type | Default | |
---|---|---|
string |
This optional property determines the optional object name text shown to the user.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 3
- 486 Change ThreadSafety of ObjectText from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ObjectText from to ReadOnly
- 454 Add ObjectText
PromptButtonHoldBegan
Parameters (1) | |
---|---|
playerWhoTriggered | Player |
This event triggers when a player begins holding down the key/button on a prompt with a non-zero ProximityPrompt.HoldDuration. One possible usage includes to animate a hold progress bar.
Thread safety | Unsafe |
---|
History 4
- 483 Change Parameters of PromptButtonHoldBegan from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 462 Change ThreadSafety of PromptButtonHoldBegan from to Unsafe
- 458 Change Parameters of PromptButtonHoldBegan from () to (playerWhoTriggered: Instance)
- 454 Add PromptButtonHoldBegan
PromptButtonHoldEnded
Parameters (1) | |
---|---|
playerWhoTriggered | Player |
This event triggers when the player ends holding down the button on a prompt with a non-zero ProximityPrompt.HoldDuration. One possible usage includes to animate a hold progress bar.
Thread safety | Unsafe |
---|
History 4
- 483 Change Parameters of PromptButtonHoldEnded from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 462 Change ThreadSafety of PromptButtonHoldEnded from to Unsafe
- 458 Change Parameters of PromptButtonHoldEnded from () to (playerWhoTriggered: Instance)
- 454 Add PromptButtonHoldEnded
PromptHidden
Parameters (0) | ||
---|---|---|
No parameters. |
This event triggers when the prompt becomes
hidden. This event is triggered client-side for LocalScripts
.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of PromptHidden from to Unsafe
- 454 Add PromptHidden
PromptShown
Parameters (1) | |
---|---|
inputType | ProximityPromptInputType |
This event triggers when the prompt becomes
visible. This event is triggered client-side for LocalScripts
.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of PromptShown from to Unsafe
- 454 Add PromptShown
RequiresLineOfSight
Type | Default | |
---|---|---|
bool | true |
This property indicates whether the prompt is hidden if the path between the player's Camera and object parented to the ProximityPrompt is obstructed. If true, this prompt will only be shown if there is a clear path from the camera to the object.
The parent Part or Model of the prompt will be excluded from this check.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of RequiresLineOfSight from to true
- 486 Change ThreadSafety of RequiresLineOfSight from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RequiresLineOfSight from to ReadOnly
- 454 Add RequiresLineOfSight
RootLocalizationTable
Type | Default | |
---|---|---|
LocalizationTable |
This property serves as a reference to the LocalizationTable used to apply automated localization to the prompt's ProximityPrompt.ActionText and ProximityPrompt.ObjectText. In order for this to apply, ProximityPrompt.AutoLocalize must be set.
Developers can set this to reference a LocalizationTable anywhere in the DataModel. It is not required to be a child of LocalizationService. If there is no translation available in the referenced table it will look for a translation in the parent of that table, if it is also a LocalizationTable, and so on.
Thread safety | ReadSafe |
---|---|
Category | Localization |
Loaded/Saved | true |
History 4
- 553 Change Default of RootLocalizationTable from to
- 486 Change ThreadSafety of RootLocalizationTable from ReadOnly to ReadSafe
- 462 Change ThreadSafety of RootLocalizationTable from to ReadOnly
- 458 Add RootLocalizationTable
Style
Type | Default | |
---|---|---|
ProximityPromptStyle | Default |
This property indicates the prompt's style. When set to Custom, no default UI will be provided.
The provided UI can be swapped out for a custom UI. In order to do this, set Style to Custom. Then, listen to the ProximityPrompt.PromptShown and ProximityPrompt.PromptHidden events in a LocalScript, where developers should create and tear down the UI.
Developers may also use ProximityPrompt.PromptButtonHoldBegan and ProximityPrompt.PromptButtonHoldEnded in order to utilize the ProximityPrompt.HoldDuration progress animation feature.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
TriggerEnded
Parameters (1) | |
---|---|
playerWhoTriggered | Player |
This event is triggered when the key/button is released, for longer events where the user is required to hold down the button (e.g. heal another player over time.)
Thread safety | Unsafe |
---|
History 3
- 483 Change Parameters of TriggerEnded from (playerWhoTriggered: Instance) to (playerWhoTriggered: Player)
- 462 Change ThreadSafety of TriggerEnded from to Unsafe
- 454 Add TriggerEnded
Triggered
Parameters (1) | |
---|---|
playerWhoTriggered | Player |
This event is triggered when the prompt key/button is pressed, or after a specified amount of time holding the button, if ProximityPrompt.HoldDuration is used.
Thread safety | Unsafe |
---|
UIOffset
Type | Default | |
---|---|---|
Vector2 | 0, 0 |
This property indicates the pixel offset applied to the prompt's UI.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |