Can you change a variable of another player by a different player?

If a player does something like walking into a circle, can you change a variable for another player?

Ex: Player 1 steps into a circle, then player 2’s string variable changes from “out” to “in”.

I tried using cast to thirdpersoncharacter, but it did not work. Is there a solution for this?

There is but your approach is bad

You enter the circle with Char 1, cast to Char 1 and want information from Char 2 which never passed his info anywhere!

There are multiple ways, also it all depends on how you store info about the existing characters

The simplest approach - Player 1 BeginPlay - Cast to Player 2 (Get Player Pawn as Object) and save as variable
Same in Player 2 but here you’ll cast to the Char 1 and save it

Now you can change everything as you have a full access to the referenced Actor

It may be that Get Player Pawn will not work correctly for 2nd player - like said before it depends on how you handle them and store (if you ever do this)

Other scenario: If your 2nd character is a separate pawn you can use “Get all actors of class” in the Player1 then select the 2nd player object from the list, get(0), save to variable and you have the reference
Now the same for 2nd char but we get player1 actor instead

You can also use Level_BP to pass the data inside of both characters if they are both placed on the map and not spawned