function ScreenSpace.ScreenToWorldByHeight(U,Z,f,Q)local K=ScreenSpace.AspectRatio()local G=math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)local w=K*G local r,F=ScreenSpace.ViewSizeX(),ScreenSpace.ViewSizeY()local c=-(F*Q)/((f*2)*G)local N,D=(U/r)*2-1,(Z/F)*2-1 local p=(N*-w)*c local E=(D*G)*c return Vector3.new(p,E,c)end
-- ScreenSpace -> WorldSpace. Taking a screen height that you want that object to be
-- and a world height that is the size of that object, and returning the position to
-- put that object at to satisfy those.
function ScreenSpace.ScreenToWorldByHeight(x, y, screenHeight, worldHeight)
	local aspectRatio = ScreenSpace.AspectRatio()
	local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView) / 2)
	local wfactor = aspectRatio * hfactor
	local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
	--
	local depth = -(sy * worldHeight) / (screenHeight * 2 * hfactor)
	--
	local xf, yf = x / sx * 2 - 1, y / sy * 2 - 1
	local xpos = xf * -wfactor * depth
	local ypos = yf * hfactor * depth
	--
	return Vector3.new(xpos, ypos, depth)
end
