# ModelService

Example usage:

```lua
-- Create a beachball above all iron blocks
local ironBlocks = BlockService.getAllBlocks({ ItemType.IRON_BLOCK })
for i, block in ipairs(ironBlocks) do
    local positionAbove = block.position + Vector3.new(0, 3, 0)
    local beachball = ModelService.createModel(ModelType.BEACHBALL, positionAbove)
    beachball:setAnchored(false)
    beachball:setCollidable(true)
    beachball:setScale(0.75)
end
```

### Functions

#### createModel(modelType: [ModelType](/scripting/bedwars-scripting/types/modeltype.md), position: [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3)): [Model](/scripting/bedwars-scripting/objects/model.md)

Creates a model of the given name at the specified position. You can further customize and give functionality to it using the returned [Model](/scripting/bedwars-scripting/objects/model.md) object.

BedWars models available for use are contained in the [ModelType](/scripting/bedwars-scripting/types/modeltype.md) list.

#### createItemModel(itemType: [ItemType](/scripting/bedwars-scripting/types/itemtype.md), position: [Vector3](https://create.roblox.com/docs/reference/engine/datatypes/Vector3)): [Model](/scripting/bedwars-scripting/objects/model.md)

Creates a model of the given ItemType at the specified position. You can further customize and give functionality to it using the returned [Model](/scripting/bedwars-scripting/objects/model.md) object. Note that some items do not have unique item models.

Example usage:

```lua
Events.BlockPlace(function(event)
    if (event.blockType ~= ItemType.STONE_BRICK) then
        return
    end    

    local model = ModelService.createItemModel(ItemType.RAGEBLADE, event.position + Vector3.new(0,4,0))
    model:setScale(1.2)
    model:setRotation(Vector3.new(0,90,0))
end)
```


---

# Agent Instructions: 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/services/modelservice.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.
