Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local center=Vector2.new(mouse.ViewSizeX/2,35 + (mouse.ViewSizeY/2))
  2.             local mousepos = Vector2.new(mouse.X,mouse.Y)
  3.             local dist=center - mousepos -- TLEFT = x,y | TRIGHT = -x,y | BRIGHT = -x,-y | BLEFT = x,-y
  4.             local directdist = findHypotenuse(dist.X,dist.Y)
  5.             if directdist > 151 then
  6.                 local angle = math.acos(dist.X / 151)
  7.                 if angle <= 0 then
  8.                 local angle = math.atan(dist.X / 151)
  9.                    
  10.                 end
  11.                 local x = center.X + (151 * math.cos(angle))
  12.                 local y = center.Y + (151 * math.sin(angle))
  13.                 gui.test.Position = UDim2.new(0,x,0,y)
  14.                 print(gui.test.Position)
  15.             elseif directdist < 16 then
  16.                 print("inside")
  17.                 dist = Vector2.new(0,0)
  18.             end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement