Estimating velocity with walkspeed

Info:
Hi. I am currently working on an anticheat for speed hacks within my combat game i’m developing. Within the game, you are able to train a speed stat which influences the speed of a sprint mechanic along with other values. Here is how I calculate the speed of the sprint:

local totalSpeed = hum.Health / hum.MaxHealth * 10 + basespeed + stats.speed

This script is also within a local script otherwise the sprint would appear late due to latency

My goal:
My goal is to, within a server script, use the above equation as a value of max walkspeed. I would then use this max walkspeed value to estimate the max velocity a player should be moving at. If the actual velocity is far greater than the estimated velocity, then either kick the player or set the velocity to 0.

Issue:
I am unsure on how to estimate the velocity the player should be going at with the max walkspeed value.

Now, very players use tweens to move fast instead of changing walkspeed, so you cant detect easily trying to see walkspeed

16 WalkSpeed = 16 studs per second. You could check distance
(lastCheckedPosition - newPosition).Magnitude
I suggest having some other way of getting the players walkspeed other than the humanoid because the client can change their walkspeed

2 Likes