|
| 05 Apr 2016 12:39 PM |
function getclosestx (x) local closest closest = 1 for i = 0.04,1,0.24 do if i > closest then closest = i end end return closest end function getclosesty (y) local closest closest = 1 for i = 0.02,1,0.14 do if i > closest then closest = i end end return closest end function SnapToGrid (X,Y,Gui) return UDim2.new(getclosestx(X),0,getclosesty(Y),0) end
It seems to be working it puts the gui in the right place but I can't see it when it moves it.
|
|
|
| Report Abuse |
|
| |
|
| 05 Apr 2016 12:44 PM |
Can't you just use modulo or math.floor for this?
|
|
|
| Report Abuse |
|