How to separate the x and y values from a vector data type to two integers, and vice versa

  1. What do you want to achieve?
    I want to be able to use the x and y position values from a GUI’s position as two separate integers, and similarly to be able to use a variable that is an integer within a vector2 to alter a GUIs position.

Specifically, my goal is to read the x position of a horizontally scrolling frame and then increase it, before updating the GUIs position with the new x position value. However, I get an error as a vector2 datatype is expected, but my variable is not accepted within the vector2. See below code.
2. What is the issue?
I do not know how to solve this in the slightest, and searching on the devforums as usual leads to irrelevant results.

sCallingAtFrame = script.Parent.ScrollFrame
sCAposition = 0

while true do
	if sCAposition >= 1000 then
		sCAposition = 0
		sCAposition = sCallingAtFrame.CanvasPosition + 5
	sCallingAtFrame.CanvasPosition =,0,0,0)

You are probably thinking of AbsolutePosition, which is a property of all GUI elements.

no. I wish to be able to separately store the x and y values from the position property, rather than as a position.

local xoffset,yoffset = Frame.Position.X.Offset,Frame.Position.Y.Offset
local xscale,yscale = Frame.Position.X.Scale,Frame.Position.Y.Scale

1 Like