How to draw a line from one point to another


I would like to know how I could write code to make a Frame appear as a line that goes from point A to point B.


you can use TweenService to move a Frame object.

pointA would be a UDim2 value to set the starter position and the same would apply for point B, but for the ending position

I think I understand what you mean, but I should’ve probably clarified: I don’t mean a moving line, I mean a static line that would start at A and extend to reach B.

oh ok. in that case, scrap TweenService

if you want to make it so u can move ponts A & B and have the line constantly re-adjust itself, you can probably use like .RenderStepped and update the line

Just off the top of my head, I believe one might do this with a simple frame and use of the Rotation and Position properties? Setting the Frame’s Anchor Point to {0.5, 0.5}, figuring out the center-point to place the frame on, and setting the frame’s size to something like {0, 200}, {0, 1}. One issue that comes to my mind with this is that rotated GUI entities might not work the best with ClipDescendants

you need to make draw script

function Draw(p1, p2, Parent)
	local Dist = (p2.Position - p1.Position).Magnitude
	local Part ="Part",Parent)
	Part.CanCollide = false
	Part.Anchored = true
	Part.Position = p1.Position
	Part.Size =,.5,Dist)
	Part.CFrame =, p2.Position) *,0,-Dist/2)

remember you need to make it as module script and activate it if script