πŸͺ¨EntityService

Service for creating new entities.

Functions

getNearbyEntities(center: Vector3, radius: number): Entity[] | nil

Returns entities contained in the radius around the center position.

spawnKitEntity(kitType: KitType, position: Vector3): KitEntity | nil

Spawns an entity using a BedWars KitType model at the specified position. Use the returned KitEntity object to further configure the KitEntity.

Example usage:

Events.MatchStart(function(event)
    -- Add a Barbarian Kit entity to the game when the match begins
    local kit = EntityService.spawnKitEntity(KitType.BARBARIAN, BlockService.getAboveRandomBlock())
    -- Give the kit entity a rageblade weapon
    kit:setHandItem(ItemType.RAGEBLADE)
    -- Gives the kit a set of Iron armor
    kit:setArmor(ItemType.IRON_HELMET)
end)

spawnCreatureEntity(creatureType: CreatureType, position: Vector3, team: Team | nil): CreatureEntity | nil

Spawns a CreatureEntity using a BedWars CreatureType model at the specified position. Use the optional team parameter with Skeletons or Ducks to set them to be allied with that Team. Use the returned CreatureEntity object to further configure the entity.

Example usage:

spawnImageEntity(image: string, position: Vector3): ImageEntity

Creates an ImageEntity using an image at the specified position. The string for the image parameter must be a rbxassetid. Use the returned ImageEntity object to further configure the entity.

Last updated