# ProximityPromptService

ProximityPromptService : `Instance`

## Overview

A service that globally manages all ProximityPrompts in the world.

It can be obtained via `game:GetService("ProximityPromptService")`.

By listening to events through this service instead of individual ProximityPrompt instances, you can handle all prompt interactions in the world from a single location.

## Properties

### Enabled

`boolean`

Enables or disables the ProximityPrompt feature for the entire service.

Setting this to false hides all prompts in the world.

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")
ProximityPromptService.Enabled = false
```

### MaxPromptsVisible

`number`

The maximum number of prompts that can be displayed on screen simultaneously.

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")
ProximityPromptService.MaxPromptsVisible = 3
```

## Methods

## Events

### PromptButtonHoldBegan

This event fires when a player begins holding the button for any ProximityPrompt in the world.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance.              |
| ------------------------ | ------------------------------------------ |
| `Player` player          | The player who started holding the button. |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptButtonHoldBegan:Connect(function(prompt, player)
    print(player.Name .. " started holding.")
end)
```

### PromptButtonHoldEnded

This event fires when a player releases the button for any ProximityPrompt in the world.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance.       |
| ------------------------ | ----------------------------------- |
| `Player` player          | The player who released the button. |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptButtonHoldEnded:Connect(function(prompt, player)
    print(player.Name .. " stopped holding.")
end)
```

### PromptHidden

This event fires when any ProximityPrompt in the world is hidden.

This event only functions in the client environment.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance that was hidden. |
| ------------------------ | --------------------------------------------- |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptHidden:Connect(function(prompt)
    print(prompt.ObjectText .. " prompt is now hidden.")
end)
```

### PromptShown

This event fires when any ProximityPrompt in the world becomes visible.

This event only functions in the client environment.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance that was shown. |
| ------------------------ | -------------------------------------------- |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptShown:Connect(function(prompt)
    print(prompt.ObjectText .. " prompt is now visible.")
end)
```

### PromptTriggered

This event fires when any ProximityPrompt in the world is activated.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance that was activated. |
| ------------------------ | ------------------------------------------------ |
| `Player` player          | The player who activated the prompt.             |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptTriggered:Connect(function(prompt, player)
    print(player.Name .. " interacted with " .. prompt.ObjectText)
end)
```

### PromptTriggerEnded

This event fires when an in-progress ProximityPrompt trigger completes or is cancelled.

#### Parameters

| `ProximityPrompt` prompt | The ProximityPrompt instance. |
| ------------------------ | ----------------------------- |
| `Player` player          | The related player.           |

#### Code Samples

```lua
local ProximityPromptService = game:GetService("ProximityPromptService")

ProximityPromptService.PromptTriggerEnded:Connect(function(prompt, player)
    print(player.Name .. "'s trigger has ended.")
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/development/api-reference/classes/proximitypromptservice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
