Entity

An Entity is anything that can take damage (player, penguin, skeleton, etc).

Functions

getPlayer(): Player | nil

Returns the player playing as this entity. If this entity is an NPC (like a Creature) 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 | nil

Returns the current position of the entity.

setPosition(position: Vector3)

Sets the position of the entity.

Example usage:

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 | nil

Returns the current CFrame of the entity.

setCFrame(cframe: 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.

Last updated