Replication "standalone" vs "play as client"


I’m trying to replicate a (double)jump by first executing it on the client and then replicating it on the server by executing the exact same code. This way the client has snappy responsiveness to controls, but when cheating the server would snap it back to place.

This works fine in “play as client” mode (both single-jump and double-jump). However when running as “standalone” only the single-jump works. I think what is happening is that the client is also the server, meaning it will execute “Start Jump” twice, increasing the jump-counter twice - thus blocking the double-jump ("you already jumped twice).

Since in standalone mode client and server are “the same instance” we need to block either the client- or the server-part from running. So one idea is to use “IsStandalone” and in that case not replicate to the server… or alternatively in standalone only replicate to server - which is ‘itself’, so don’t think that really matters (so guaranteed no lag, should respond snappy either way + and making the possibility of cheating irrelevant also).

(standalone / don’t replicate to server)

(standalone / only replicate on server)

Is this the correct approach, or are there better ways to do this?

Jump input: Switch has authority[remote] → Jump → RPC server
RPC Server[run on server]: Switch has authority[auth] → Jump