Scrolling Frame is not showing all of the items within it

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want a way for the scrolling frame to create enough space to add more slot room.

  2. What is the issue? Include screenshots / videos if possible!
    When an item is add to the scrolling frame or when the idea just loades in the scroll it doesn’t show all of the items.
    Medal_11riceUyIp

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried playing around with AbsoluteSize and nothing seemed to work, I also tryed LayoutUtil and i didn’t understand it.

Here here is the code related to the problem

   function Inventory:newUI(Folder)
	print("Creating new UI for: ", Folder)
	local inventoryUI = InventTemplate:Clone()
	local FolderPets = ReplicatedStore.Assets.Items:FindFirstChild(Folder.Name)
	local ModelClone = FolderPets.PrimaryPart:Clone()
	local RarityColor = Rarities[Folder.Rarity].Color
	local Camera = Instance.new("Camera", inventoryUI.Button.ViewportFrame)
	local Pos = Vector3.new(0, 0, 0)

	inventoryUI.Name = Folder.Name
	inventoryUI.Button.ItemName.Text = Folder.Name
	inventoryUI.Button.Rarity.Text = Folder.Rarity
	inventoryUI.Button.Rarity.TextColor3 = RarityColor
	inventoryUI.Button.Value.Text = tostring(Folder.Value)

	inventoryUI.Button.ViewportFrame.CurrentCamera = Camera

	FolderPets:SetPrimaryPartCFrame(CFrame.new(Pos))
	ModelClone.Parent = inventoryUI.Button.ViewportFrame
	Camera.CFrame = CFrame.Angles(0, math.rad(-180), 0)
		* CFrame.new(Pos + Vector3.new(0, 0, 3.5), Pos + Vector3.new(0, 0, 0))
	inventoryUI.Parent = InventScroll

	-- self:MapSellButton(inventoryUI, Folder)
	-- self:MapListItemsButton(inventoryUI, Folder)

	
	-- for item, value in pairs(PetScrollingFrame:GetChildren()) do
	-- 	task.wait()
	--     if not value:IsA("UIGridLayout") then
	--         value.LayoutOrder = getLayoutOrder(value:GetAttribute("PetID"))
	--     end
	-- end
end

function Inventory:UpdateInventoryUI(addedItems, removedItems)
	-- Handle added items
	for _, item in pairs(addedItems) do
		local newItemButton = InventTemplate:Clone()
		newItemButton.Parent = InventScroll
		newItemButton.Name = item.Name

		newItemButton.Button.ItemName.Text = item.Name
		newItemButton.Button.Rarity.Text = item.Rarity
		newItemButton.Button.Value.Text = tostring(item.Value)

		newItemButton.Button.MouseButton1Click:Connect(function()
			Inventory:selectItem(newItemButton)
		end)

		-- self:MapSellButton(newItemButton, item.Name)
		-- self:MapListItemsButton(newItemButton, item.Name)
	end

	
	-- Handle removed items
	for _, itemName in pairs(removedItems) do
		local itemButton = InventScroll:FindFirstChild(itemName)
		if itemButton then
			itemButton:Destroy()
		end
	end

end


ReplicaController.ReplicaOfClassCreated("PlayerData_" .. Player.UserId, function(replica)
	if not replica then
		return
	end
	for item, value in pairs(replica.Data.ItemInventory.Inventory) do
		print("Item: ", item, "Value: ", value)
		Inventory:newUI(value)
	end
	BagSize.Text = tostring(#replica.Data.ItemInventory.Inventory)
		.. "/"
		.. tostring(replica.Data.ItemInventory.MaxBagSize)
	replica:ListenToArrayInsert({ "ItemInventory", "Inventory" }, function(_, newValue)
		print("Added item: ", newValue.Name)
		Inventory:UpdateInventoryUI({ newValue }, {})
		BagSize.Text = tostring(#newValue) .. "/" .. tostring(replica.Data.ItemInventory.MaxBagSize)
	end)
	replica:ListenToArrayRemove({ "ItemInventory", "Inventory" }, function(_, removedValue)
		--- printing the removed items
		print("Removed item: ", removedValue.Name)

		Inventory:UpdateInventoryUI({}, { removedValue })
		BagSize.Text = tostring(#replica.Data.ItemInventory.Inventory)
			.. "/"
			.. tostring(replica.Data.ItemInventory.MaxBagSize)
	end)
end)

Have you tried changing CanvasSize? Typically it changes how much area is scrollable. If you’re using scale, you might have to change the size of them elements inside. Hope this helps!

You can try setting the AutomaticCanvasSize property of the scrolling frame to Y. (Enum.AutomaticSize.Y)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.