BuildGUI Open maker

Template · inventory

Roblox inventory GUI template

A 3x3 slot grid in Luau: nine rounded tiles with automatic layout, ready for your item icons. Copy it, paste it, fill it with your own items.

What this inventory template builds

A centred panel with a title, a close button and a 3x3 grid of nine rounded slots. Each slot is a TextButton with AutoButtonColor off, so dropping an icon inside it does not change the tile colour on hover. Slots are numbered by LayoutOrder, which means the ninth slot never jumps to the top when you insert a new one.

It is the Inventory template in the Roblox GUI maker, rendered with the dark surface and an 8-pixel corner.

The code

local panel = Instance.new("Frame")
panel.Name = "InventoryPanel"
panel.AnchorPoint = Vector2.new(0.5, 0.5)
panel.Position = UDim2.fromScale(0.5, 0.5)
panel.Size = UDim2.fromScale(0.54, 0.56)
panel.Parent = screenGui

local items = Instance.new("ScrollingFrame")
items.Name = "Slots"
items.Position = UDim2.fromOffset(16, 46)
items.Size = UDim2.new(1, -32, 1, -62)
items.AutomaticCanvasSize = Enum.AutomaticSize.Y
items.Parent = panel

local grid = Instance.new("UIGridLayout")
grid.CellSize = UDim2.fromOffset(64, 64)
grid.CellPadding = UDim2.fromOffset(8, 8)
grid.Parent = items

for i = 1, 9 do
  local slot = Instance.new("TextButton")
  slot.Name = "Slot" .. i
  slot.LayoutOrder = i
  slot.AutoButtonColor = false
  slot.BackgroundColor3 = Color3.fromRGB(31, 36, 45)
  slot.BorderSizePixel = 0
  slot.Text = ""
  slot.Parent = items

  local slotCorner = Instance.new("UICorner")
  slotCorner.CornerRadius = UDim.new(0, 6)
  slotCorner.Parent = slot
end

Turning slots into an inventory

Put icons in the slots. Inside the loop, add a child ImageLabel:

local icon = Instance.new("ImageLabel")
icon.Name = "Icon"
icon.BackgroundTransparency = 1
icon.Size = UDim2.fromScale(0.72, 0.72)
icon.Position = UDim2.fromScale(0.5, 0.5)
icon.AnchorPoint = Vector2.new(0.5, 0.5)
icon.Image = "rbxassetid://0"
icon.Parent = slot

Keep the ImageLabel's aspect ratio with a child UIAspectRatioConstraint set to 1 if your icons are square.

Fill it from data. The slots exist before the player owns anything. Write a function that clears Icon.Image on all nine slots and then fills the first N from a table, so the same code handles an empty and a full inventory.

Stack counts. Add a TextLabel in the bottom-right corner of each slot for quantities — AnchorPoint = Vector2.new(1, 1), Position = UDim2.new(1, -4, 1, -2), TextSize = 12. Turn on TextStrokeTransparency so the number stays readable over bright icons.

Drag and drop. Roblox's built-in UIDragDetector is enough for a simple grid; if you want swapping between two slots, track slot.Name in a table and swap the Image values instead of moving the instances.

Making the grid fit

Nine 64-pixel cells with 8-pixel padding need 208 pixels of width. That fits inside the panel on a phone, which is why the default is 64 rather than 96. If your items are large illustrations instead of icons, raise CellSize to 80 and let the third column drop to the next row — the ScrollingFrame recalculates its canvas height automatically.

For a hotbar that sits at the bottom of the screen instead of a full inventory, use the HUD template and swap the pills for nine slots.

Related pages

FAQ

Why are the slots empty? They are containers. The maker does not know which items your game has, so it builds the grid and leaves the icons to you.

Can I make it 4 columns? Yes — increase the panel width and raise CellSize, or set grid.FillDirectionMaxCells = 4.

Does the close button work? Yes, it sets screenGui.Enabled = false, which hides the panel without destroying it.