ForeverDev

Untitled

Oct 23rd, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. game.StarterGui:SetCoreGuiEnabled("All", false)
  2.  
  3. local cx = 692 / 2
  4. local cy = 449 / 2
  5.  
  6. local bx = 692
  7. local by = 449
  8.  
  9. local sqrt, deg, acos, pow, abs = math.sqrt, math.deg, math.acos, math.pow, math.abs
  10.  
  11. local distance = function(point1, point2)
  12.     return abs(sqrt(pow(point2.Y - point1.Y, 2) + pow(point2.X - point1.X, 2)))
  13. end
  14.  
  15. local angle = function(point1, point2)
  16.     return abs(deg(acos((point2.X - point1.X) / (distance(point1, point2)))))
  17. end
  18.  
  19. local seg = function(x1, y1, x2, y2)
  20.     local point1, point2 = Vector2.new(x1, y1), Vector2.new(x2, y2)
  21.  
  22.     local new = Instance.new("TextLabel", script.Parent)
  23.     new.Text = ""
  24.     new.Size = UDim2.new(0, distance(point1, point2), 0, 1)
  25.     new.Position = UDim2.new(0, (point1 + (((point2 - point1).unit) * (distance(point1, point2) / 2))).X - new.Size.X.Offset/2, 0, point1.Y + ((point2.Y - point1.Y) / 2))
  26.     new.Rotation = angle(point1, point2)
  27.     new.BorderSizePixel = 0
  28.     new.BackgroundColor3 = Color3.new(1, 0, 0)
  29.    
  30.     return {
  31.         angle = new.Rotation,
  32.         length = new.Size.X.Offset,
  33.         dest = function()
  34.             new:Destroy()
  35.         end
  36.     }
  37. end
  38.  
  39. seg(50, 50, 250, 250)
Advertisement
Add Comment
Please, Sign In to add comment