When testing my game on multiplayer, the gravity doesn't change for other players

I’m new to UE4, like I just started today. My script is supposed to change gravity to 0 when holding down right click, and back to 1 when it’s released. It worked in singleplayer, but when I tested it in “Play as Listen Server” option, it doesn’t work for the other players. Does anyone know why this is happening?