Basically, im reworking a localscript to work on the server for a game im creating. What I have set up is a function that takes an instance, sends it to the client to identify and get certain client-only properties (such as absolutesize and absoluteposition), and send it back. The code is here:

serverscript:

function GetAbsolutePosition(instance2)
	print(instance2)
	game.ReplicatedStorage.Events.GetAbsolutePosition:FireClient(Player, instance2)
	local AbsolutePosition = nil;
	
		game.ReplicatedStorage.Events.ReturnPosition.OnServerEvent:connect(function(player, AbPosition)
			print("Got Result")
			AbsolutePosition = AbPosition
		end)
		
		while true do
			if AbsolutePosition ~= nil then
				return AbsolutePosition
			end
			wait()
			if AbsolutePosition ~= nil then
				break;
			end
			wait()
		end
end

localscript:

spawn(function()
	game.ReplicatedStorage.Events.GetAbsolutePosition.OnClientEvent:connect(function(instance)
		print(instance.ClassName)
		game.ReplicatedStorage.Events.ReturnPosition:FireServer(instance.AbsolutePosition)
	end)
end)

The above code currently works. I modified it to also get the absolute size of the GUI object, but this time on the client side, it gives a nil instance error. Server Size Code:

function GetAbsoluteSize(instance)
	print(instance.ClassName .. " Is Sizing")
	if instance == nil then
		print("NIL INSTANCE NHJSHBJFBHJKBKHJSFKBHJSFKBHJFSBKHJ")
	end
	game.ReplicatedStorage.Events.GetAbsoluteSize:FireClient(Player, instance)
	local AbsoluteSize = nil;
	
		game.ReplicatedStorage.Events.ReturnSize.OnServerEvent:connect(function(player, AbSize)
			print("Got Result")
			AbsoluteSize = AbSize
		end)
		
		while true do
			if AbsoluteSize ~= nil then
				return AbsoluteSize
			end
			wait()
			if AbsoluteSize ~= nil then
				break;
			end
			wait()
		end
end

LocalScript:


spawn(function()
	game.ReplicatedStorage.Events.GetAbsoluteSize.OnClientEvent:connect(function(instance2)
		print(instance2.ClassName .. " has reached renderstepped")
		game.ReplicatedStorage.Events.ReturnSize:FireServer(instance2.AbsoluteSize)
	end)
end)

The two are practically the same code, so im very confused on why the bottom one does not work. I've tried almost everything I know at this point, and nothing seems to work.