Stef_Dev
(Stef_Dev)
#1
Simple question
How to be able to find the position between two UDIM2 positions
I`ve tried searching but didnt manage to find anything helpfull
and I tried doing (UDim2 + UDim2) / 2 when it errored I tried doing
UDim2.new(
(UDim2.X.Scale + UDim2.X.Scale) / 2 ,
(UDim2.X.Offset + UDim2.X.Offset) / 2,
(UDim2.Y.Scale + UDim2.Y.Scale) / 2
(UDim2.Y.Offset + UDim2.Y.Offset) / 2
)
but it didn`t work once again
any Help in appriciated!
You’re getting the average of the two, not the difference. Remove the /2
and use the -
sign instead.
1 Like
Nidoxs
(Nidoxs)
#3
This is straight forward given one understands the properties of a GuiObject.
local PositionSum = GuiObject.AbsolutePosition + GuiObject2.AbsolutePosition
local CenterPosition = PositionSum / 2
Note: This is a Vector2 value, so you’ll need to input it as an offset position value instead of scale.
As in:
UDim2.new(0,CenterPosition.X, 0, CenterPosition.Y)
2 Likes
wait no sorry i thought you want the center of two udim
1 Like
Stef_Dev
(Stef_Dev)
#6
do you mean (UDim2.X.Scale - UDim2.X.Scale)?