ScrollingFrame Issue, Items are not displayed

Hello so recently I’ve tried to learn about ScrollingFrames and how i could use one in my game.
I am very new to Lua and Coding in Roblox Studio in general.
I’ve created an item list and want that you are able to scroll through all the items. Sadly the Scrolling bar stops at a specific point and the rest of the items won’t be displayed.

image

Help would be really appreciated . Thank you already ~ Avisk

1 Like

I’ve had the same issue. It’s because of the fact you’re using scale. Unfortunately you can only offset with a UIGridLayout. It won’t scale the canvas size properly for some stupid reason.

oh no D:, so does that mean there is no real solution for this

After adding every new item try updating the ScrollingFrame’s CanvasSize Y to the UIGridLayout AbsoluteContentSize.Y

2 Likes

You can try doing this:

local ScrollingFrame = ... -- you know
local UIGridLayoit = ScrollingFrame.UIGridLayout
local ScaleInOffset = UDim2.fromOffset(UIGridLayout.CellSize.Scale.X / ScrollingGui.AbsoluteSize.X, UIGridLayout.CellSize.Scale.Y / ScrollingGui.AbsoluteSize.Y)

That also doesn’t work with scale, I’ve tried that. But you can convert it to offset and do that.

I am very new to all of this and i am not sure right now how to actually use that information :sweat_smile: very sorry

You can try something like this in the localscript you have.

local scrollFrame = script.Parent;

scrollFrame.UIGridLayout.CellSize = UDim2.new(0, scrollFrame.UIGridLayout.CellSize.X.Scale * scrollFrame.AbsoluteSize.X, 0, scrollFrame.UIGridLayout.CellSize.Y.Scale * scrollFrame.AbsoluteSize.Y);
scrollFrame.CanvasSize = UDim2.new(scrollFrame.CanvasSize.X.Scale, scrollFrame.CanvasSize.X.Offset, 0, scrollFrame.UIGridLayout.AbsoluteContentSize.Y);

scrollFrame.ChildAdded:Connect(function()
    scrollFrame.CanvasSize = UDim2.new(scrollFrame.CanvasSize.X.Scale, scrollFrame.CanvasSize.X.Offset, 0, scrollFrame.UIGridLayout.AbsoluteContentSize.Y);
end);
1 Like

OMG i dont know what i did wrong now image

Can you show me the properties of the ScrollingFrame and the UIGridLayout?
Also, are you using scale or offset originally in the UIGridLayout CellSize?

yes of course
ScrollingFrame

UIGridLayout

Try removing line 3. Your using offset already so it shouldn’t resize as you add more.

I removed line 3
image

Can you upload the place file please? I can’t see the reason it isn’t working right now it’d be easier to try and fix it live. There is always the option of removing the script entirely and setting the CanvasSize of the ScrollingFrame higher but then there would be a limit so if items are added over time then it may fill up again.

Im not feeling comfortable sharing my place publicly, sorry :frowning:

Not much more I can say at this point then, don’t want to go too deep for something that probably has a simple answer. If you can’t get the script working the answer to the original question is setting the Y offset of the CanvasSize to the Y AbsoluteContentSize of the UIGridLayout. AbsoluteContentSize will give you the actual size it takes up. Good luck though.

1 Like

thank you very much for your help though, sorry it wasnt easy to work with me xdd

1 Like