Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
ProximityPrompt
Inherits from: Instance → Object
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 |
Class.ProximityPrompt.ObjectText|ObjectText | An optional name for the object being interacted with. | |
Class.ProximityPrompt.ActionText|ActionText | An optional action name shown to the player. | Interact |
Class.ProximityPrompt.KeyboardKeyCode|KeyboardKeyCode | The keyboard key which will trigger the prompt. | E |
Class.ProximityPrompt.GamepadKeyCode|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.
Inherits from: Instance
Memory category: Instances
Code samples: View on Creator Hub (using-a-proximity-prompt-with-a-seat, generating-a-custom-proximity-prompt, healing-proximity-prompt).
Properties
| Name | Type / Returns | Description |
|---|---|---|
| ProximityPrompt.ActionText | string | The action text shown to the user. |
| ProximityPrompt.AutoLocalize | boolean | Whether the prompt's ProximityPrompt.ActionText and ProximityPrompt.ObjectText will be localized according to the ProximityPrompt.RootLocalizationTable. |
| ProximityPrompt.ClickablePrompt | boolean | Whether the prompt can be activated by clicking/tapping on the prompt UI. |
| ProximityPrompt.Enabled | boolean | Whether or not this prompt should be shown. |
| ProximityPrompt.Exclusivity | ProximityPromptExclusivity | Used to customize which prompts can be shown at the same time. |
| ProximityPrompt.GamepadKeyCode | KeyCode | The gamepad button the player should press to trigger the prompt. |
| ProximityPrompt.HoldDuration | float | The duration, in seconds, that the player must hold the button/key down to trigger the prompt. |
| ProximityPrompt.KeyboardKeyCode | KeyCode | The key the player should press to trigger the prompt. |
| ProximityPrompt.MaxActivationDistance | float | The maximum distance a Player's character can be from the ProximityPrompt for the prompt to appear. |
| ProximityPrompt.MaxIndicatorDistance | float | The maximum distance at which a lightweight indicator for the prompt is shown, hinting at a nearby interaction before the player is close enough to trigger it. |
| ProximityPrompt.ObjectText | string | An optional property that determines the object name text shown to the user. |
| ProximityPrompt.RequiresLineOfSight | boolean | Whether the prompt is hidden if the path between the player's Camera and object parented to the ProximityPrompt is obstructed. |
| ProximityPrompt.RootLocalizationTable | LocalizationTable | A reference to a LocalizationTable to be used to apply automated localization to this prompt's ProximityPrompt.ActionText and ProximityPrompt.ObjectText. |
| ProximityPrompt.Style | ProximityPromptStyle | The style of the prompt's UI. |
| ProximityPrompt.UIOffset | Vector2 | The pixel offset applied to the prompt's UI. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
ProximityPrompt.ActionText
This property determines the action text shown to the user.
| Field | Value |
|---|---|
| type | string |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.AutoLocalize
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.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Localization |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.ClickablePrompt
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.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.Enabled
This property indicates whether or this ProximityPrompt should be shown.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.Exclusivity
This property is used to customize which prompts can be shown at the same time.
| Field | Value |
|---|---|
| type | ProximityPromptExclusivity |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.GamepadKeyCode
This property determines the gamepad button the player should press to trigger the ProximityPrompt. Default is ButtonX.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.HoldDuration
This property indicates the duration, in seconds, that the player must hold the button/key down to trigger the prompt.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.KeyboardKeyCode
This property determines the key the player should press to trigger the ProximityPrompt. Default is E.
| Field | Value |
|---|---|
| type | KeyCode |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.MaxActivationDistance
This property determines the maximum distance a Player's character can be from the ProximityPrompt for the prompt to appear.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.MaxIndicatorDistance
The maximum distance a player's character can be from the ProximityPrompt for a lightweight indicator to appear. An indicator is shown while the player is farther than ProximityPrompt.MaxActivationDistance but no farther than MaxIndicatorDistance, hinting that an interaction is nearby before the prompt itself becomes active.
The default is 0, which disables the indicator; an indicator only appears when this property is set to a value greater than 0. The number of indicators shown at once is capped by ProximityPromptService.MaxIndicatorsVisible.
| Field | Value |
|---|---|
| type | float |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.ObjectText
This optional property determines the optional object name text shown to the user.
| Field | Value |
|---|---|
| type | string |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.RequiresLineOfSight
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.
| Field | Value |
|---|---|
| type | boolean |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.RootLocalizationTable
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.
| Field | Value |
|---|---|
| type | LocalizationTable |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Localization |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.Style
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.
| Field | Value |
|---|---|
| type | ProximityPromptStyle |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
ProximityPrompt.UIOffset
This property indicates the pixel offset applied to the prompt's UI.
| Field | Value |
|---|---|
| type | Vector2 |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":true,"can_save":true} |
| capabilities | ["UI","Input"] |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| ProximityPrompt:InputHoldBegin | () | Fires a signal indicating that the user began pressing the prompt GUI button. |
| ProximityPrompt:InputHoldEnd | () | Fires a signal indicating that the user ended pressing the prompt GUI button. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
ProximityPrompt:InputHoldBegin
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.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI","Input"] |
ProximityPrompt:InputHoldEnd
A counterpoint to ProximityPrompt:InputHoldBegin(), this signals that the user ended pressing the prompt GUI button.
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
| capabilities | ["UI","Input"] |
Events
| Name | Type / Returns | Description |
|---|---|---|
| ProximityPrompt.IndicatorHidden | Fires on the client when a lightweight indicator for the prompt is no longer shown. | |
| ProximityPrompt.IndicatorShown | Fires on the client when a lightweight indicator for the prompt becomes visible. | |
| ProximityPrompt.PromptButtonHoldBegan | Triggered when a player begins holding down the key/button connected to a prompt with a non-zero ProximityPrompt.HoldDuration. | |
| ProximityPrompt.PromptButtonHoldEnded | Triggers when the player ends holding down the button on a prompt with a non-zero ProximityPrompt.HoldDuration. | |
| ProximityPrompt.PromptHidden | Triggers when the prompt becomes hidden. | |
| ProximityPrompt.PromptShown | Triggers when the prompt becomes visible. | |
| ProximityPrompt.Triggered | Triggered when the prompt key/button is pressed, or after a specified amount of time holding the button, if ProximityPrompt.HoldDuration is used. | |
| ProximityPrompt.TriggerEnded | Triggers when key/button is released, for longer events where the user is required to hold down the button. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
ProximityPrompt.IndicatorHidden
Fires client-side when a lightweight indicator for this ProximityPrompt is hidden, which occurs when the player's character moves farther than ProximityPrompt.MaxIndicatorDistance from the prompt or the prompt itself becomes active. Use this event to tear down a custom indicator UI.
As with ProximityPrompt.IndicatorShown, indicators only appear when ProximityPrompt.MaxIndicatorDistance is set to a value greater than 0; it defaults to 0.
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.IndicatorShown
Fires client-side when a lightweight indicator for this ProximityPrompt becomes visible, which occurs when the player's character is within ProximityPrompt.MaxIndicatorDistance of the prompt but still farther away than ProximityPrompt.MaxActivationDistance. Listen to this event to render a custom indicator UI.
Because ProximityPrompt.MaxIndicatorDistance defaults to 0, indicators are disabled unless you set it to a value greater than 0.
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.PromptButtonHoldBegan
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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| playerWhoTriggered | Player | The Player who begins holding down the prompt button. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.PromptButtonHoldEnded
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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| playerWhoTriggered | Player | The player who ended the input hold. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.PromptHidden
This event triggers when the prompt becomes hidden. This event is triggered client-side for LocalScripts.
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.PromptShown
This event triggers when the prompt becomes visible. This event is triggered client-side for LocalScripts.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputType | ProximityPromptInputType | The input that triggers the prompt. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.Triggered
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.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| playerWhoTriggered | Player | The Player who triggered the prompt. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |
ProximityPrompt.TriggerEnded
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.)
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| playerWhoTriggered | Player | The Player who released the key/button, ending the trigger event. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["UI","Input"] |