Compare client and server properties at the same time

I’m making an anti exploit that uses a RemoteFunction to compare Client and Server values for the humanoid. The only problem is, messages between the client and server take time to send so when I read values on the client they might not match anymore by the time the server reads those values.

Is there any event I can rely on that fires the same time for the client and server so that these values are measured accurately?

Before I answer your question I should probably note that remote event requests (Client → Server) can be intercepted by a rogue client.

Now onto the question. What you can try doing is flooring the current timestamp an integer and then the client will send that as a makeshift key of some sort. You will do the same on the server and you can then cache the values inside a dictionary with the time stamp as the key.

So if the clients time is 1234567.89 you can floor it to 1234567 and do the same on the server for the servers time. Then index a dictionary for the key they send and compare your data to the data they sent.

Some pseudo code.

local timeStamps = {}

local now = math.flooor(tick())

timeStamps[now] = {
    WalkSpeed = currentWalkSpeed

You will also want to clear the old timeStamps every so often to prevent filling memory over time.
Also there is a small window where data is lost (a full second of it, so if a position changes to 0, 0, 0 and then .5 seconds later to 0, 1, 0 the position might be set as 0, 1, 0)

I will once again note, having the client send information to the server that you are comparing for something like this is extremely risky. Your data will likely be intercepted.

I am aware that client are able to intercept requests and I have certain methods I wish not to explain of attempting to making that a little bit harder.

Anyways, this will work for me, thank you!

Glad I could help. :sunglasses: :+1:

If you find a better method I ask of you to send me a message on how it works. I am always interested in how sanitization of the client’s information could work.

1 Like