Boolean Randomly Changing to false

I have a boolean called ismoving in one of my classes. On the client side, this boolean works as expected, it only becomes true when I call a certain function

and it only becomes false after a certain condition in another function

These two locations are literally the only points at which ismoving can change value (other than the initialization in the constructor). However, on the server side, ismoving, when it’s meant to be true, rapidly switches between true and false for no reason.


I’ve checked if its reaching ismoving = false multiple times (it’s not) and even more strangely, if I delete ismoving = false entirely, it still goes back to being false somehow.

I think this is an issue with multiplayer because if I set my game to 1 person, this no longer occurs on the server side, but I have no clue whats happening because ismoving isn’t replecated and shouldnt be affected by the number of players in the game.

Someone please help, I am actually going insane from this issue :slight_smile:

You’re setting it to false on client, but it remains true on server. Both values are printed to the log.

No I have HasAuthority before the log

Alright, another guess: is your bool Replicated? If it is replicated and you set it to false on the client, it becomes false for a tick, but then the server replicates true back to the client, and so it changes back and forth all the time?

It is not replicated

Ur just not boolin fam, what can i say

ur just not booling hard enough

i have been having the same problem.

Alright. I have fixed the issue. For some reason this rapid switching does not occur if I transfer this variable to a uobject that has no owner (not owned by server or client) and then set and read the variable in this uobject. I have no idea why this fix works, but it does.