Ad
Log in to vote
0

How to make ScrollingFrame autoscroll?

Asked by 14 days ago

Help how to make autoscroll in ScrollingFrame so that it scrolls to the size of the gui that is in the ScrollingFrame

1 answer

Log in to vote
0
Answered by 14 days ago

If you have something like a UIListLayout or UIGridLayout, you can use the following code.

local layout = -- Reference your UI layout object
local scrollingFrame = -- Reference your scrolling frame

local function setSize()
    local contentSize = layout.AbsoluteContentSize
    scrollingFrame.CanvasSize = Vector2.new(contentSize.X, contentSize.Y)
end
setSize() -- Update the size as soon as the game starts so if there is already something in it, it will be displayed correctly.

layout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
    setSize()
end)

This code uses the GetPropertyChangedSignal event to detect when the total size of the content being manipulated by the UI layout object is changed. This means that if something new gets added to the scrolling frame, it will automatically update.

0
I don’t have this, I need it to scroll one object that is stretched andremega0302 2 — 14d
0
You may be able to use AbsoluteContentSize on the scrolling frame too. namespace25 594 — 13d
Ad

Answer this question