local function M(M,B,f,e,D)return((M-B)*(D-e))/(f-B)+e end local function B(M,B)local f=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera:ScreenPointToRay(M.X,M.Y)return f.Origin+f.Direction*B end local function f()local B=(game:GetService("\087\111\114\107\115\112\097\099\101")).CurrentCamera.ViewportSize.Y return M(B,0,2560,8,56)end return{B;f}
local function map(value, inMin, inMax, outMin, outMax)
	return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin
end

local function viewportPointToWorld(location, distance)
	local unitRay = game:GetService("Workspace").CurrentCamera:ScreenPointToRay(location.X, location.Y)
	return unitRay.Origin + unitRay.Direction * distance
end

local function getOffset()
	local viewportSizeY = game:GetService("Workspace").CurrentCamera.ViewportSize.Y
	return map(viewportSizeY, 0, 2560, 8, 56)
end

return { viewportPointToWorld, getOffset }
