Comment on page
🎁
ModelService
Service for creating models.
Example usage:
-- 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
Creates a model of the given name at the specified position. You can further customize and give functionality to it using the returned Model object.
Creates a model of the given ItemType at the specified position. You can further customize and give functionality to it using the returned Model object. Note that some items do not have unique item models.
Example usage:
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)
Last modified 4mo ago