> 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/playergui.md).

# PlayerGui

PlayerGui : `Instance`

## Overview

PlayerGui is a client-only container that is automatically created when a player joins the game. It is located under the Player instance within the Players service and serves as the location for running client-side scripts

When a player joins the game, all UI elements from the StarterGui service are copied into their PlayerGui once and only once.

The LocalScripts inside this container run on the client associated with that player.

Since UI elements are shown from PlayerGui, and not from StarterGui, you need to access PlayerGui, not StarterGui, to manage UI during gameplay as follows:

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

local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui

local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
local TextLabel = ScreenGui:WaitForChild("TextLabel")

TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
```

## Properties

## Methods

### GetGuiObjectsAtPosition

A method that finds the UI elements at the specified screen coordinates in all ScreenGuis under the PlayerGui and returns them as an array.

To find only the descendants of a specific ScreenGui, use GetGuiObjectsAtPosition() of the ScreenGui.

#### Parameters

| `number` x | The X coordinate (in pixels) on screen. |
| ---------- | --------------------------------------- |
| `number` y | The Y coordinate (in pixels) on screen. |

#### Return

| `Array` | An array of GuiObjects at the coordinates. |
| ------- | ------------------------------------------ |

#### Code Samples

```lua
local Players = game:GetService("Players")
local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")

local PositionX = 150
local PositionY = 200
local GuiObjects = PlayerGui:GetGuiObjectsAtPosition(PositionX, PositionY)
for _, guiObject in ipairs(GuiObjects) do
    print(guiObject.Name)
end
```

## Events
