ProximityPromptService

Mostrar obsoleto
serviço
não navegável

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.

Resumo

Propriedades

Eventos

Propriedades

Enabled

ler parallel

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:


local ProximityPromptService = game:GetService("ProximityPromptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enablePrompts = ReplicatedStorage:FindFirstChild("EnablePrompts") -- BindableEvent
-- Connect to the BindableEvent and fire from another script controlling experience logic
enablePrompts.OnServerEvent:Connect(function(enabled)
ProximityPromptService.Enabled = enabled
end)

MaxPromptsVisible

ler parallel

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

Métodos

Eventos

PromptButtonHoldBegan

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

Parâmetros

The prompt that the player begins interacting with.

playerWhoTriggered: Player

The player who holds the key/button.


PromptButtonHoldEnded

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

Parâmetros

The prompt that the player stops interacting with.

playerWhoTriggered: Player

The player who releases the held key/button.


PromptHidden

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

Parâmetros

The prompt instance that becomes hidden.


PromptShown

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

Parâmetros

The prompt instance that becomes visible.

The input that triggered the event.


PromptTriggerEnded

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.

Parâmetros

The prompt that the player stops interacting with.

playerWhoTriggered: Player

The player that releases the key/button.


PromptTriggered

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.

Parâmetros

The prompt that the player interacts with.

playerWhoTriggered: Player

The interacting player.