Hi everyone,
I am having an issue with a multiplayer project using CoBlocks where a conditional check based on variables isn’t triggering an action, even though the variables appear to change correctly for the players.
What I want to achieve: I have a 2-player multiplayer session. When the item Circle is clicked, I want the project to detect who clicked it.
-
If the Host (
É anfitrião) clicks it, the variableP1should becometrue(verdadeiro). -
If the Guest (
senão) clicks it, the variableP2should becometrue(verdadeiro). -
Once both variables (
P1andP2) aretrue, an information panel should pop up.
The Problem: As you can see in the 3D view, both text panels display “true”, meaning the variables are successfully being changed to verdadeiro by the respective players. However, the repeat forever (repetir indefinidamente) loop containing the condition if P1 == true and P2 == true never triggers the information panel.
It seems like the variables P1 and P2 are being updated locally on each player’s client, but they are not syncing across the network to validate the and (e) condition together.
My current code structure (as shown in the screenshot):
-
On start:
P1andP2are set tofalse. -
When
Circleis clicked: Splits intoif host/elseto setP1orP2totrueand update the local text signs. -
In a separate parallel block (
Executar separadamente): A continuous loop checks if bothP1andP2equaltrueto show the info panel.
Is there a specific way to force variables to sync globally in multiplayer, or a better workaround to check conditions achieved by different players in the same session?
Any help or insights would be greatly appreciated!
Thank you!
