I want to change the variable in another pawn when I click on the button

you were telling them to use get all actors which would change the variable on everyone of the actors of that class instead of just one specific instance. your answer is wrong and is perpetuating the use of the get all actors of class node in the wrong circumstances so thats the reason for the downvote.