Slots
Types
SlotContext
Info about the slot being rendered. Passed as the argument to the onSlotRender callback.
Type
luautype SlotContext = { item: BackpackItem, inHotbar: boolean?, order: number, }Properties
Property Type Description itemBackpackItemThe item occupying this slot. inHotbarboolean?Whether the slot is in the hotbar. nilif in the inventory.ordernumberThe visual position of the slot (1-based).
SlotProperties
The return value of the onSlotRender callback. All properties are optional — any property not returned will use its default value.
Type
luautype SlotProperties = { BackgroundColor: Color3?, BackgroundTransparency: number?, Children: { Instance }?, ItemNameText: string?, ItemNameChildren: { Instance }?, }Properties
Property Type Description BackgroundColorColor3?Overrides the slot's background color. BackgroundTransparencynumber?Overrides the slot's background transparency. Children{ Instance }?Instances parented into the slot frame (e.g. UIGradient).ItemNameTextstring?Overrides the item name label text. Supports rich text. ItemNameChildren{ Instance }?Instances parented into the item name label (e.g. UIGradient).
Functions
onSlotRender()
Registers a callback that runs whenever a slot is rendered. Use it to customize individual slots based on their item.
This function can only be called once. Calling it more than once will throw an error.
Type
luaufunction sling.onSlotRender(callback: (context: SlotContext) -> SlotProperties)