Skip to content

Service · inherits Instance

ProximityPromptService

Official docs ↗

Allows developers to interact with ProximityPrompt objects in a global way.

About ProximityPromptService

ProximityPromptService allows developers to interact with ProximityPrompt objects in a global way. It may be more convenient to listen to events through this service rather than on individual ProximityPrompt objects.

Properties 3

  • Enabled: booleanWhether ProximityPrompts are enabled, and therefore shown, in-experience.

    This property determines whether ProximityPrompts are enabled, and therefore shown, in-experience. When false, no prompts will be shown.

    For example, in a round-based system, you can disable prompts at certain points in the experience to disable proximity-based interactions:

  • MaxIndicatorsVisible: intMaximum number of prompt indicators that can be visible at once.

    This property sets the maximum number of prompt indicators that can be visible at the same time. Indicators are lightweight distance hints shown for ProximityPrompts when the player is within the prompt's MaxIndicatorDistance but still outside its MaxActivationDistance.

    This property defaults to 16 and is clamped to the range [0, 64]. Because indicators are opt-in per prompt — a prompt's MaxIndicatorDistance defaults to 0, which disables its indicator — this property has no visible effect unless at least one prompt sets a non-zero MaxIndicatorDistance.

  • MaxPromptsVisible: intMaximum number of ProximityPrompts that will be shown to the player.

    This property indicates the maximum number of ProximityPrompts that will be shown to the player.

Events 8

  • IndicatorHiddenProximityPromptService.IndicatorHidden:Connect(function(prompt))Triggers client-side when a prompt's indicator becomes hidden.

    This event triggers client-side in connected local scripts when the indicator for a ProximityPrompt is no longer visible, such as when the player moves outside the prompt's MaxIndicatorDistance or the prompt is disabled. It is the counterpart to IndicatorShown and is convenient for tearing down custom indicator UI globally rather than connecting to each individual ProximityPrompt.

  • IndicatorShownProximityPromptService.IndicatorShown:Connect(function(prompt))Triggers client-side when a prompt's indicator becomes visible.

    This event triggers client-side in connected local scripts when the indicator for a ProximityPrompt becomes visible, which happens when the player moves within the prompt's MaxIndicatorDistance but remains outside its MaxActivationDistance. Indicators are opt-in: a prompt only shows one when its MaxIndicatorDistance is set greater than 0 (the default of 0 disables the indicator). Listening on the service rather than on each ProximityPrompt is convenient when implementing custom indicator UI globally.

  • PromptButtonHoldBeganProximityPromptService.PromptButtonHoldBegan:Connect(function(prompt, playerWhoTriggered))Triggers when the player begins holding down the KeyboardKeyCode key/button on a prompt with a non-zero HoldDuration.

    This event triggers when the player begins holding down the KeyboardKeyCode key/button on a prompt with a non-zero HoldDuration.

  • PromptButtonHoldEndedProximityPromptService.PromptButtonHoldEnded:Connect(function(prompt, playerWhoTriggered))Triggers when the player stops holding down the KeyboardKeyCode key/button on a prompt with a non-zero HoldDuration.

    This event triggers when the player stops holding down the KeyboardKeyCode key/button on a prompt with a non-zero HoldDuration.

  • PromptHiddenProximityPromptService.PromptHidden:Connect(function(prompt))Triggers client-side when a prompt becomes hidden.

    This event triggers client-side in connected local scripts when a prompt becomes hidden.

  • PromptShownProximityPromptService.PromptShown:Connect(function(prompt, inputType))Triggers client-side when a prompt becomes visible.

    This event triggers client-side in connected local scripts when a prompt becomes visible.

  • PromptTriggeredProximityPromptService.PromptTriggered:Connect(function(prompt, playerWhoTriggered))Triggers when the user interacts with this prompt.

    This event triggers when the player completes interaction with a prompt, either when the KeyboardKeyCode key/button is pressed, or after a specified amount of time holding the key/button if the prompt's HoldDuration is non-zero.

  • PromptTriggerEndedProximityPromptService.PromptTriggerEnded:Connect(function(prompt, playerWhoTriggered))Triggers when the player stops holding down the KeyboardKeyCode key/button while triggering a prompt.

    This event triggers when the player stops holding down the KeyboardKeyCode key/button while triggering a prompt. This is intended to allow interactions which require the player to hold a key/button while something happens in-experience.

ProximityPromptService also has every member of Instance. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.