> For the complete documentation index, see [llms.txt](https://docs.easy.gg/scripting/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.easy.gg/scripting/bedwars-scripting/objects/entity.md).

# Entity

### Functions

#### getPlayer(): [Player](broken://pages/fOfVQF5nlALekCoylPz2) | nil

Returns the player playing as this entity. If this entity is an NPC (like a [Creature](/scripting/bedwars-scripting/objects/entity/creatureentity.md)) this will return nil.

#### getHealth(): number

Returns current health of the entity.

#### getMaxHealth(): number

Returns max health of the entity.

#### isAlive(): bool

Returns true if the entity is alive.

#### getPosition(): [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3) | nil

Returns the current position of the entity.

#### setPosition(position: [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3))

Sets the position of the entity.

Example usage:

```lua
Events.BlockPlace(function(event)
    local entity = event.player:getEntity()
    if not entity then
        return
    end
    entity:setPosition(event.position + Vector3.new(0,3,0))
end)
```

#### getCFrame(): [CFrame](https://create.roblox.com/docs/reference/engine/datatypes/CFrame) | nil

Returns the current CFrame of the entity.

#### setCFrame(cframe: [CFrame](https://create.roblox.com/docs/reference/engine/datatypes/CFrame))

Sets the CFrame of the entity.

#### setMaxHealth(health: number)

Sets the max health of the entity.

#### setCustomName(name: string): nil

Sets a custom display name on the entity's healthbar.

#### destroy()

Destroys the entity.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.easy.gg/scripting/bedwars-scripting/objects/entity.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.
