How do I put my CanvasPosition Y Axis to its max position?


Issue

All I’m trying to do is make it so my Y value for CanvasPosition is at it’s max when adding a frame.

This doesn’t apply any changes to the CanvasPosition at all.

Workarounds

None, I’ve tried doing it via the client & the server, no change at all.

Line of Code

local SFrame = script.Parent --ScrollingFrame
SFrame.CanvasPosition = Vector2.new(0,math.huge)

Thank you for any assistance you can provide.


After Note

Alright, so I’ve noticed that this solution does work for a certain amount of time but after adding so many frames into the GUI… it became clear that this solution was only temporary so I created my own.

local max = 2^63-1 --The max variable possible.
SFrame.CanvasPosition = Vector2.new(0,max)

This is the current solution I found and it seems to work.

1 Like

Use the AbsoluteSize.Y property of the parented ScreenGui instance. This will match the Y dimension of the native device. If the scrolling frame is parented to the ScreenGui instance the following will work.

local screenGui = script.Parent.Parent
local nativeDeviceYSize = screenGui.AbsoluteSize.Y
local SFrame = script.Parent --ScrollingFrame
SFrame.CanvasPosition = Vector2.new(0, nativeDeviceYSize)
1 Like

Although the ScrollingFrame is inside a ScreenGui, this did not work. Do you have any other recommendations?

Is it directly parented to the ScreenGui? Or is it a distant descendant of the ScreenGui? The script will only work if directly parented.

It is a descendant of the ScreenGui;
image
However, it is also the direct child to the ScreenGui;
image

For lack of a better phrase “distant descendant” refers to a descendant which is 2 or more hierarchical levels deeper than the ScreenGui. In other words a descendant which is not a child.

oh, well I actually figured out the issue; I had to move where I added more frames and where it changes its position, you were right. It worked. Thank you!