Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local center=Vector2.new(mouse.ViewSizeX/2,35 + (mouse.ViewSizeY/2))
- local mousepos = Vector2.new(mouse.X,mouse.Y)
- local dist=center - mousepos -- TLEFT = x,y | TRIGHT = -x,y | BRIGHT = -x,-y | BLEFT = x,-y
- local directdist = findHypotenuse(dist.X,dist.Y)
- if directdist > 151 then
- local angle = math.acos(dist.X / 151)
- if angle <= 0 then
- local angle = math.atan(dist.X / 151)
- end
- local x = center.X + (151 * math.cos(angle))
- local y = center.Y + (151 * math.sin(angle))
- gui.test.Position = UDim2.new(0,x,0,y)
- print(gui.test.Position)
- elseif directdist < 16 then
- print("inside")
- dist = Vector2.new(0,0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement