ProximityPrompt
Displays an interaction prompt near a parent part.
- Creatable
Instance.new("ProximityPrompt")- Inherits
- Instance
- Replication
- Standard
Behavior
ProximityPrompt displays ObjectText and ActionText when a player enters
activation range. Triggered fires on the server when the player completes the
interaction. Parent the prompt to a part.
Summary
The action label displayed by the prompt, such as "Open".
Whether the prompt can be activated by pointer input.
Whether the prompt is available for display and activation.
Exclusivity: Enum.ProximityPromptExclusivity = Enum.ProximityPromptExclusivity.OnePerButtonparallel readThe policy used when several proximity prompts compete for visibility or input.
The gamepad button used to activate the prompt.
The required hold time in seconds.
The keyboard key used to activate the prompt.
The maximum distance from the parent part, in studs, at which the prompt appears.
The object label displayed beside ActionText, such as "Supply Crate".
Whether geometry can occlude the prompt.
The global lighting style.
The screen-space offset applied to the prompt interface.
Returns this instance if it is an ExecutionGroup.
Begins the prompt's hold interaction from custom input code.
Ends the prompt's hold interaction from custom input code.
Fires when a player starts holding the activation input.
Fires when the hold stops, whether it completed or was released early.
Fires when the prompt becomes hidden, including when disabled or out of range.
Fires when the prompt becomes visible to a player.
Fires when the prompt's triggering interaction ends.
Fires on the server when a player completes activation.
Properties
ActionText
ProximityPrompt.ActionText: string = ""The action label displayed by the prompt, such as "Open".
ClickablePrompt
ProximityPrompt.ClickablePrompt: boolean = trueWhether the prompt can be activated by pointer input.
Enabled
ProximityPrompt.Enabled: boolean = trueWhether the prompt is available for display and activation.
Exclusivity
ProximityPrompt.Exclusivity: Enum.ProximityPromptExclusivity = Enum.ProximityPromptExclusivity.OnePerButtonThe policy used when several proximity prompts compete for visibility or input.
GamepadKeyCode
ProximityPrompt.GamepadKeyCode: Enum.KeyCode = Enum.KeyCode.ButtonAThe gamepad button used to activate the prompt.
HoldDuration
ProximityPrompt.HoldDuration: number = 0The required hold time in seconds. A value of 0 activates on a press. PromptButtonHoldBegan and PromptButtonHoldEnded report hold state.
KeyboardKeyCode
ProximityPrompt.KeyboardKeyCode: Enum.KeyCode = Enum.KeyCode.EThe keyboard key used to activate the prompt.
MaxActivationDistance
ProximityPrompt.MaxActivationDistance: number = 10The maximum distance from the parent part, in studs, at which the prompt appears.
ObjectText
ProximityPrompt.ObjectText: string = ""The object label displayed beside ActionText, such as "Supply Crate".
RequiresLineOfSight
ProximityPrompt.RequiresLineOfSight: boolean = trueWhether geometry can occlude the prompt.
Style
ProximityPrompt.Style: Enum.ProximityPromptStyle = Enum.ProximityPromptStyle.DefaultThe global lighting style.
UIOffset
ProximityPrompt.UIOffset: Vector2 = Vector2.new(0, 0)The screen-space offset applied to the prompt interface.
Methods
GetExecutionGroup
ProximityPrompt:GetExecutionGroup(): ExecutionGroup?Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.
InputHoldBegin
ProximityPrompt:InputHoldBegin(): booleanBegins the prompt's hold interaction from custom input code.
InputHoldEnd
ProximityPrompt:InputHoldEnd(): booleanEnds the prompt's hold interaction from custom input code.
Events
PromptButtonHoldBegan
ProximityPrompt.PromptButtonHoldBegan: RBXScriptSignalFires when a player starts holding the activation input.
PromptButtonHoldEnded
ProximityPrompt.PromptButtonHoldEnded: RBXScriptSignalFires when the hold stops, whether it completed or was released early.
PromptHidden
ProximityPrompt.PromptHidden: RBXScriptSignalFires when the prompt becomes hidden, including when disabled or out of range.
PromptShown
ProximityPrompt.PromptShown: RBXScriptSignalFires when the prompt becomes visible to a player.
TriggerEnded
ProximityPrompt.TriggerEnded: RBXScriptSignalFires when the prompt's triggering interaction ends.
Triggered
ProximityPrompt.Triggered: RBXScriptSignalFires on the server when a player completes activation. Passes the player. If HoldDuration is greater than 0, the hold must finish first.
Inherited members
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Example
-- Parent this prompt to the target Part.
local prompt = Instance.new("ProximityPrompt")
prompt.ActionText = "Open"
prompt.HoldDuration = 0.5