How to get Inventory Formatting

Hello, So basically I’m creating an inventory and then I realized that I would need to format the inventory, so my question is how would I format the inventory items?

As an example: Let’s say a row is already full, and I want it to start putting items in another row, how would I do that?

-- // Services \\ -- 

local RunServices = game:GetService("RunService")

local StarterGUI = game:GetService("StarterGui")

-- // Variables \\ --

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild('Humanoid')

local InventoryHUD = script.Parent

local InventoryBackground = InventoryHUD.Background

local Enabled = false

-- // Main Script \\ --

RunServices.RenderStepped:Connect(function()
	
StarterGUI:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
	
end)

local function Update()
	if Enabled == false then
		Enabled = true
		
		InventoryBackground.Visible = true
		
		--InventoryBackground.Size = UDim2.new(0,0,0,20*#Player.Backpack:GetChildren())
		
		
		for i, v in pairs(game:GetService("ReplicatedStorage").PlayerInventory:GetChildren())do
			
			
			local ItemFrame = Instance.new("TextButton")
			ItemFrame.TextSize = 25 
		ItemFrame.Parent = InventoryBackground
		ItemFrame.Size = UDim2.new(0.2, 0,0.098, 0)	
			ItemFrame.Position = UDim2.new(0.39*i-0.39,0,0,0)
		ItemFrame.TextWrapped = true
		ItemFrame.Text = v.Name
		ItemFrame.Font = Enum.Font.Highway
		ItemFrame.BackgroundTransparency = 1
			
			ItemFrame.MouseButton1Click:Connect(function()
				
				Humanoid:UnequipTools()
				Humanoid:EquipTool(v)
				
				
			end)	
			
		end
	else
		Enabled = false
		InventoryBackground.Visible = false
		
	end
	
	
end


	
	Update()

--Player.Backpack.Changed:Connect(function()
--	if Enabled == false then Enabled = true and Update() end
--	if Enabled == true then Enabled = false and Update() end
	
	
--end)


thanks a lot!

Swift

Use scrolling frame, then use uilistlayout.

2 Likes

can I ask what a uilistlayout is?

or if you have any links, just tell me.

Thanks a lot,

SwiftNumbr

it’s easy to search, can’t send links rn cuz mobile.

Just search “UIListLayout” in Google.

Alright thank you man.

Thank you again,
Swift

80 minutes of content, hope it helps.

2 Likes