# Entity

### Functions

#### getPlayer(): [Player](https://docs.easy.gg/scripting/bedwars-scripting/objects/broken-reference) | nil

Returns the player playing as this entity. If this entity is an NPC (like a [Creature](https://docs.easy.gg/scripting/bedwars-scripting/objects/entity/creatureentity)) 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.
