How would I accurately see if a user is at the bottom of a ScrollingFrame and can’t scroll down anymore?
I’m pretty sure you could use the CanvasPosition property of the ScrollingFrame to do this.
Perhaps something like:
if ScrollingFrame.CanvasPosition == Vector2.new(0,0)
Then replace 0,0 with the bottom of your frame.
That’s great but my frame size is frequently changing, so how would I be able to detect the position of the bottom of the frame at any given time?
I’m not on my PC right now, so I can’t check for sure but:
There’s a property which is called CanvasSize which can help you (i believe). You can get the CanvasSize property value, assign that to a variable and then check for that. Something like this:
local sizeVector = Udim2.new(ScrollingFrame.CanvasSize)
if ScrollingFrame.CanvasPosition == sizeVector then
EDIT: It may be AbsoluteWindowSize or another property, apologies as I can't check right now.
The CanvasPosition and CanvasSize values don’t correspond with each other. If my canvas size is 200 pixels but I scroll to the bottom, the canvas position will not be 200. In my case the size was like 1048 but the position was like 30 when I was at the bottom.
Is there a value that does? Like, if you watch the properties tab and scroll down in the ScrollingFrame, does the CanvasPosition match anything else?
Based on the values above, I noticed that the sum of CanvasPositon and AbsoluteSize will equal the CanvasSize whenever you are at the bottom of the frame.
Here’s the code I used to see if the frame was scrolled to the bottom:
if script.Parent.CanvasPosition.Y == script.Parent.CanvasSize.Y.Offset - script.Parent.AbsoluteSize.Y then
return true
end