Service · inherits Instance
ProximityPromptService
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
: booleanWhetherProximityPromptsare enabled, and therefore shown, in-experience.This property determines whether
ProximityPromptsare 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
ProximityPromptswhen the player is within the prompt'sMaxIndicatorDistancebut still outside itsMaxActivationDistance.This property defaults to
16and is clamped to the range[0, 64]. Because indicators are opt-in per prompt — a prompt'sMaxIndicatorDistancedefaults to0, which disables its indicator — this property has no visible effect unless at least one prompt sets a non-zeroMaxIndicatorDistance.MaxPromptsVisible
: intMaximum number ofProximityPromptsthat will be shown to the player.This property indicates the maximum number of
ProximityPromptsthat will be shown to the player.
Events 8
IndicatorHidden
ProximityPromptService.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
ProximityPromptis no longer visible, such as when the player moves outside the prompt'sMaxIndicatorDistanceor the prompt is disabled. It is the counterpart toIndicatorShownand is convenient for tearing down custom indicator UI globally rather than connecting to each individualProximityPrompt.IndicatorShown
ProximityPromptService.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
ProximityPromptbecomes visible, which happens when the player moves within the prompt'sMaxIndicatorDistancebut remains outside itsMaxActivationDistance. Indicators are opt-in: a prompt only shows one when itsMaxIndicatorDistanceis set greater than0(the default of0disables the indicator). Listening on the service rather than on eachProximityPromptis convenient when implementing custom indicator UI globally.PromptButtonHoldBegan
ProximityPromptService.PromptButtonHoldBegan:Connect(function(prompt, playerWhoTriggered))Triggers when the player begins holding down theKeyboardKeyCodekey/button on a prompt with a non-zeroHoldDuration.This event triggers when the player begins holding down the
KeyboardKeyCodekey/button on a prompt with a non-zeroHoldDuration.PromptButtonHoldEnded
ProximityPromptService.PromptButtonHoldEnded:Connect(function(prompt, playerWhoTriggered))Triggers when the player stops holding down theKeyboardKeyCodekey/button on a prompt with a non-zeroHoldDuration.This event triggers when the player stops holding down the
KeyboardKeyCodekey/button on a prompt with a non-zeroHoldDuration.PromptHidden
ProximityPromptService.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.
PromptShown
ProximityPromptService.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.
PromptTriggered
ProximityPromptService.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
KeyboardKeyCodekey/button is pressed, or after a specified amount of time holding the key/button if the prompt'sHoldDurationis non-zero.PromptTriggerEnded
ProximityPromptService.PromptTriggerEnded:Connect(function(prompt, playerWhoTriggered))Triggers when the player stops holding down theKeyboardKeyCodekey/button while triggering a prompt.This event triggers when the player stops holding down the
KeyboardKeyCodekey/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.