Magnitude screen size help

Hello, I have a a ton of gui frames and want to get all the guis in a radius of the mouse. I have the code but it changes depending on the device or size of the screen. How can I fix this?

local function getNearbyGui(origin,maxDistance,objs)
	local distance = maxDistance/2
	local frames = {}
	for _, gui in pairs(objs) do
		local objdist = (origin - gui.AbsolutePosition).Magnitude
		if objdist < distance then
			table.insert(frames, gui)
		end
	end
	return frames
end