How would I wait for 2 players input?

Hi, I want to make code that waits for two player’s inputs. For example, say there was a game that had max 2 players server size. And in the game you make equations like x + y = z. One player can ONLY put the x and the other player can ONLY put the y. If you understand what I mean. How would I go about doing this?

Basically what you could do is just register both of the players inputs like normal on the server, and on each input check to see if both values have been entered by each player and you can just go from there.

Here’s the most simples example i can give you:

local Values = {
	Value1 = nil,
	Value2 = nil
}

function UpdateValues(NewValue)
	if not Values.Value1 then Values.Value1 = NewValue end
	if not Values.Value2 then Values.Value2 = NewValue end
	
	if Values.Value1 and Values.Value2 then
		...
	end
end

Remote.OnServerEvent:Connect(function(Player, NewValue)
	UpdateValues(NewValue)
end)