Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sqrt, deg, acos, pow, abs = math.sqrt, math.deg, math.acos, math.pow, math.abs
- local distance = function(point1, point2)
- return abs(sqrt(pow(point2.Y - point1.Y, 2) + pow(point2.X - point1.X, 2)))
- end
- local angle = function(point1, point2)
- return abs(deg(acos((point2.X - point1.X) / (distance(point1, point2)))))
- end
- local newLine = function(x1, y1, x2, y2)
- local point1, point2 = Vector2.new(x1, y1), Vector2.new(x2, y2)
- local line = Instance.new("TextLabel", script.Parent)
- line.Text = ""
- line.Size = UDim2.new(0, distance(point1, point2), 0, 1)
- line.Position = UDim2.new(0, (point1 + (((point2 - point1).unit) * (distance(point1, point2) / 2))).X - line.Size.X.Offset/2, 0, point1.Y + ((point2.Y - point1.Y) / 2))
- line.Rotation = angle(point1, point2)
- line.BorderSizePixel = 0
- line.BackgroundColor3 = Color3.new(1, 0, 0)
- end
Advertisement
Add Comment
Please, Sign In to add comment