Getting the bottom of an ScrollingFrame

I am creating an inventory and I need to be able to know when the player reaches the bottom of a ScrollignFrame, I have tried using

	if ScrollingFrame.CanvasPosition.Y == ScrollingFrame.CanvasSize.Y.Offset - ScrollingFrame.AbsoluteSize.Y then
		print("bottom")
	end

But it doesn’t work, As far as I can tell none of the properties in the Frame are being changed as the AutomaticCanvasSize adjusts the ScrollingFrame. Am I being stupid and missing something super basic or is this unintended behavior?

I tried running

ScrollingFrame.Changed:Connect(function(Changed)
	print(Changed)
end)

And when I add elements that expand the ScrollingFrame it prints nothing only CanvasPosition if it was at the bottom and I removed an element.

1 Like

Got a workaround solution which just checks for a new child into the ScrollingFrame then sets the CanvasPosition to a high number and storing what CanvasPosition is clamped to.

local highestPosition = 0

MainFrame.ScrollingFrame.ChildAdded:Connect(function(newChild)
	wait()
	local lastScrollPosition = MainFrame.ScrollingFrame.CanvasPosition
	MainFrame.ScrollingFrame.CanvasPosition = Vector2.new(0, 9999999999)
	highestPosition = MainFrame.ScrollingFrame.CanvasPosition.Y
	MainFrame.ScrollingFrame.CanvasPosition = lastScrollPosition
end)

MainFrame.ScrollingFrame:GetPropertyChangedSignal("CanvasPosition"):Connect(function()
	print("CanvasPosition, ", MainFrame.ScrollingFrame.CanvasPosition.Y)
	if MainFrame.ScrollingFrame.CanvasPosition.Y >= highestPosition then
		print("bottom")
	end
end)

I got the same issue and I tried to run this code and nothing is working it just prints the canvas position and it prints “bottom” when Im not even at the bottom. It seems to print bottom every time I scroll once.