Is there a way to sync Heartbeat in Server with Heartbeat in LocalScript?

I need to align security and performance.
My game moves parts inside RunService | Roblox Creator Documentation.


  • If I move the parts inside LocalScript, the performance is good, but the script is vulnerable to exploiters.
  • If I move the parts inside the Server, the script is safe from exploiters, but the performance is poor (due to the latency of communication between the server and the client).

One of the solutions I thought was:

  1. Having a Heartbeat on the server, just for table calculations, without officially changing the CFrame of the objects moved… this would avoid the replication of these positions between the server and all connected players;
  2. At the same time, having another Heartbeat in the Localscript, doing the same Server table calculations, but there, updating the CFrame of the moved parts. This would also prevent communication between client and server.

My only concern for this solution would be: how to ensure that Server and LocalScript are synchronized in FPS?

Because if that’s not possible, this idea won’t be viable.

If it is synchronization you are looking for, then just run the heartbeat on the server and use events for communication.

1 Like

I believe that’s what he is trying to avoid doing…

No, maybe @Developer6786 is right.
A remote event fired from Server’s Heartbeat to Localscript sending nothing, but just to say “ok LocalScript, run 1 frame” may be a good idea.
I’ll test it.

Indeed, you have the answer.

1 Like