Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
2
Answered by 8 years ago

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

0
it worked! thank you so much!!! Gwolflover 80 — 8y
0
np ScriptsAhoy 202 — 8y
Ad

Answer this question