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

How do I store a UDim2Value? (Without using tables)

Asked by 9 years ago

I'm trying to make the position of a textbutton save so when it moves, I can move it back to it's original position. In order to do this, I need to have a way to save the position. How do I do this? (Without tables: if you're going to do this with tables please give a extremely descriptive tutorial)

1 answer

Log in to vote
1
Answered by
Discern 1007 Moderation Voter
9 years ago

So I'm going to assume that there is one original position.

So just create 4 variables; 1 for each aspect of the UDim2 value.

--ORIGINAL POSITION--
XScale = 0
XOffset = 0
YScale = 0
YOffset = 0
---------------------

So you would set each of them to each part of your UDim2 value. Then when you're ready to set it back, just insert the variables in for the new UDim2 value.

TextButton.Size = UDim2.new(XScale, XOffset, YScale, YOffset)

Note: They must be in the same script.

Ad

Answer this question