generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I'm trying to make a Snap to Grid thing for a screen gui

Previous Thread :: Next Thread 
fierydragonkeeper is not online. fierydragonkeeper
Joined: 08 Oct 2012
Total Posts: 1192
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
fierydragonkeeper is not online. fierydragonkeeper
Joined: 08 Oct 2012
Total Posts: 1192
05 Apr 2016 12:41 PM
It puts it at 1,0,1,0



Report Abuse
Dannythebedbug is not online. Dannythebedbug
Joined: 04 Jul 2011
Total Posts: 86
05 Apr 2016 12:44 PM
Can't you just use modulo or math.floor for this?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image