Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i refer to the x and y values of GUI already in existence?

For a script I'm writing, I need to define x and y, and they need to be the x and y values of the position of a button called "CURRENT". is there a way to do this? I tried

local x = CURRENT.Position.UDim2.new.x 
local y = CURRENT.Position.UDim2.new.y 

but obviously UDim2 isn't a part of Position. Let me know if I need to clarify anything. Thanks!

1 answer

✓ Accepted answer

Like this:

xOff = CURRENT.Position.X.Offset--will get the offset for x
xScale = CURRENT.Position.X.Scale--will get the scale value for x
yOff = CURRENT.Position.Y.Offset--will get the offset for y
yScale = CURRENT.Position.Y.Scale--will get the scale for y
print(CURRENT.Position)--will print 4 nums(i think)
print(CURRENT.Position.Y)--should print 2, both the y scale and offsets
print(CURRENT.Position.Y.Offset)--will just print the y offset

for further information check the wiki page for UDim2

2 comments

0

it worked! thank you so much!!!

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.