Best function for server and client sync:

Sorry for that title, I want to stop a timer on contact with a part, but rather than giving client the authority, I want to check for touched on server then subtract the delay/ping. What is the best function for such action?

I can use a remote event but it could be abused

use Player:GetNetworkPing() altho I don’t know how accurate it is

That’s right, it’s not.

Honestly, I wouldn’t worry about the delay. It’s most likely a small delay that would be negligible. Remote Events would also have the same delay most likely, so it wouldn’t be a good substitute.

Just do the .Touched on the server in my opinion.

1 Like

Delay depends on ping. My game is single player and time sensitive. Its a speed running parkour game.

This post

Talks about the :GetNetworkPing(). To shorten, the ping returned is a One-Way trip. To fix that, multiply the returned amount by 1000 to turn into ms and then by 2.

Also, don’t quote me on this, but if all you do when the part is touched is send an information to the server, then I think you only need to know how long it takes for a One-Way trip. I’m not sure tho.

hm, maybe log the moment the player touches the part on the client, and the moment the player touches the part on the server, then compare the two to get your delay?

Touch events are serversided, aren’t they? Just have the timer start on the server and have it end on the server.

If that’s not accurate enough, you can have the client send their value of Workspace.GetServerTime at the start and end (ensuring these are sent within a threshold of the serverside start/end) and ensure that it’s not too different from the server’s + client’s latency + some extra tolerance (be careful if it’s multiplicative). Use the server time if the difference is too high or just drop it.

A RemoteEvent being abused is a failure of the programmer who used them, not the remote event itself.