How would I make an inventory system like this?

I’d like an idea on making an inventory system with slots and stuff. I’ve tried to use modules but I don’t know how to add it to then ui and stuff.

Here’s an image of what i’m trying to replicate:
Screenshot 2021-12-23 212304

like you said how to add something to the slot
idk if this would help

local InventoryFolder = game.Players.LocalPlayer:WaitForChild("Inventory")  

local SlotParent = script.Parent -- Parent of the slots

local Slots = {SlotParent.Slot1, SlotParent.Slot2, SlotParent.Slot3} -- This are Text Buttons

-- I also recommended set 'AutoButtonColor' property of the buttons to false

InventoryFolder.ChildAdded:Connect(function(WEAPON)

	--
	local CurrentSlot = Slots[#InventoryFolder:GetChildren()] -- Getting the slot
	--
	--Change Property
	CurrentSlot.Text = WEAPON.Name
	CurrentSlot.AutoButtonColor = true -- Add the effect only ofc players might confused 
	--
	--
	local Connection1 = CurrentSlot.MouseButton1Down:Connect(function()
		--Stuff will do	
		--Add
		--Idk
	end)
	--
	local Connection2 
	Connection2 = WEAPON.Destroying:Connect(function() -- Disconnecting the function when the thing is deleted
		Connection1:Disconnect()
		Connection2:Disconnect() 
	end)
end)

InventoryFolder.ChildRemoved:Connect(function(WEAPON)

	--
	for _, Slot in pairs(SlotParent:GetChildren()) do 
		if Slot.Text == WEAPON.Name then -- Getting the weapon deleted

			-- Back the original Property
			Slot.AutoButtonColor = false 
			Slot.Text = "" 

		end
	end

end)

That is a complicated procedure, based on how efficient u want to make it. I’d use OOP for this, as it wud b way easier to mange and cleaner.

this may very well be complicated if you never done an inventory system, let alone shop system.

this is how i would do it

Obviously for loops would be involved in this, whatever is being bought from shop need to be added to inventory, yes? So you need to store the new items in some sort of folder for the player’s client to access and OnChildAdded or whenever you click inventory, you should update the inventory with contents and for loop through the set of items or like OnChildAdded, just put the child added in the closest available space.

I understand how this works, but how would I add an unlimited page system to this without using a UIPageLayout since there would be a limit to that.