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

How can you move UDim2s on a grid?

Like in increments, like every 100 pixels or something, I have no clue where to start for this at all, any help is appreciated.

1 answer

Snap!

Just round it to the closest 100 in any direction. When you want to set its X/Y, just round the X/Y off.

function snap(x,y,step)
  return math.floor(x/step+0.5)*step, math.floor(t/step+0.5)*step
end

That rounds the x and y to the closest interval of step and returns them. You want to use this for the offset part of the UDim2.

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