> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/classes/proximitypromptservice.md).

# 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.       |
| ----------------------------------------- | -------------------------------------------------- |
| `Enum.ProximityPromptInputType` inputType | The input type that caused the prompt to be shown. |

#### Code Samples

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

ProximityPromptService.PromptShown:Connect(function(prompt, inputType)
    print(prompt.ObjectText .. " prompt is now visible.", inputType)
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)
```
