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, Vector.X, 0, Vector.Y)
		local delt = Vector2ToUdim2(Input.Position - DragStart) 
		--local Offset = --Vector2ToUdim2((DragObject.Parent.Position - DragObject.Position) )
		if IsWindow then
			local Cent = (DragObject.Parent.AbsolutePosition + DragObject.AbsolutePosition) / 2
			local Offset =, Cent.X, 0, Cent.Y) 
			delt -= Offset
			DragObject.Parent.Position =, StartPosition.X.Offset + delt.X.Offset, StartPosition.Y.Scale, StartPosition.Y.Offset + delt.Y.Offset)