Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local StartPoint = script.Parent.StartPoint.AbsolutePosition;
- local EndPoint = script.Parent.EndPoint.AbsolutePosition;
- function DrawLine(Start, End, Width)
- local Start_O, End_O = Start, End
- if (Start.X > End.X) then
- End = Start_O
- Start = End_O
- end
- local Line = Instance.new("Frame");
- local XSize = (End-Start).magnitude;
- local XDistance = (End.X-Start.X);
- local YDistance = (End.Y-Start.Y);
- local DesiredAngle = math.atan2(YDistance,XDistance);
- local YPositionOffset = YDistance/2;
- local XOffset = (1 - math.cos(DesiredAngle)) * (XSize/2)
- print("Distances :: " .. XDistance .. ", " .. YDistance);
- print("Needed angle :: " .. math.deg(DesiredAngle));
- Line.Rotation = math.deg(DesiredAngle);
- Line.BorderSizePixel = 0;
- Line.Size = UDim2.new(0,XSize,0,Width);
- Line.Position = UDim2.new(0,Start.X-XOffset,0,Start.Y + YPositionOffset);
- Line.Parent = script.Parent
- print("Distance between GUIs :: " .. XSize);
- return Line;
- end
- DrawLine(StartPoint,EndPoint,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement