I know how to draw a line with a part, but not with a gui.

function line(x,y)
	local v1 = Vector2.new(x.X.Offset,x.X.Offset)
	local v2 = Vector2.new(y.Y.Offset,y.Y.Offset)
	local center = (v1+v2)/2
	local dis = (v1-v2).magnitude
	local g = Instance.new("Frame")
	g:ClearAllChildren() --ignore this
	g.Rotation = center.X
	g.Size = vector2(dis,1)
	g.Position = UDim2.new(0,center.X/2,0,center.Y)
	g.BorderSizePixel = 0
	g.BackgroundColor3 = Color3.new(1,0,0)
	g.Parent = f
	return g
end

This doesn't work right. Help would be appreciated .