How to draw a line from one point to another

Hello.

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.

Thanks

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
like

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

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