How can i detect when a ScrollingFrame has reached the end
isn’t there a property for the current position in pixels?
you can compare that to the absolute size and times it by the canvas size
You basically wanna check if the scrolling frames canvas position is greater or equal to the furthest down the player can scroll
local scrollingFrame = script.Parent -- reference to your ScrollingFrame
local function scrollend()
return scrollingFrame.CanvasPosition.Y >= scrollingFrame.CanvasSize.Y - scrollingFrame.AbsoluteSize.Y
end
game:GetService("RunService").RenderStepped:Connect(function()
if isScrolledToEnd() then print("scrolled to end”)
end
end)
The reason this works is because when you subtract absoluteY (the space you view in the frame at any time) from the Canvas sizeY (the height of amount of content in the frame), you get the lowest scroll position possible. So if canvas position Y (the position you’re at in the frame) is greater or equal to the lowest possible scroll position, you’re at the end.
Note that scrolling down increases the value of ui element Y values, for some reason
a
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.