Frame spazzes out when apply offset

I’m trying to recreate an application window. I understand the concept of using the delta and adding it to the position, but since windows can only be moved with the top bar, I have tried calculating the offset of the 2 positions, and it seems to half work, goes elsewhere. I suspect it might have something to do with it being negative half the time(hence the output), but I’m not completely sure as I don’t know what to do now. I’ve been trying many solutions but it just bugs out again and the offset appears exponentially increase sometimes. Right now seems the closest.

Here’s the portion of the script:

local function Update(Input)
		local function Vector2ToUdim2(Vector : Vector2)
			return UDim2.new(0, Vector.X, 0, Vector.Y)
		end
		local delt = Vector2ToUdim2(Input.Position - DragStart) 
		--local Offset = UDim2.new(DragObject.Parent.Position) --Vector2ToUdim2((DragObject.Parent.Position - DragObject.Position) )
		if IsWindow then
			local Cent = (DragObject.Parent.AbsolutePosition + DragObject.AbsolutePosition) / 2
			local Offset = UDim2.new(0, Cent.X, 0, Cent.Y) 
			delt -= Offset
			DragObject.Parent.Position = UDim2.new(StartPosition.X.Scale, StartPosition.X.Offset + delt.X.Offset, StartPosition.Y.Scale, StartPosition.Y.Offset + delt.Y.Offset) 
			print(Offset)