-- anti tp and anti walkspeed--
local timeSinceLast = nil
local walkspeed = char.Humanoid.WalkSpeed + 14
local lastpos = nil
game:GetService("RunService").Heartbeat:Connect(function()
if lastpos ~= nil then
local distance = (char.HumanoidRootPart.Position - lastpos)
local newWalkspeed = math.ceil(((Vector3.new(lastpos.X, 0, lastpos.Z) - Vector3.new(char.HumanoidRootPart.Position.x, 0, char.HumanoidRootPart.Position.Z)).Magnitude) / ((time() - timeSinceLast))) -- ((time()- timeSinceLast)))
if newWalkspeed > walkspeed then
plr:Kick("????")
end
end
lastpos = char.HumanoidRootPart.Position
walkspeed = char.Humanoid.WalkSpeed
timeSinceLast = time()
end)
For some reason, when I print(newWalkspeed) it tends to jump to high numbers way above the actual walkspeed towards the beginning. I believe this has to do with acceleration but im not quite sure.

2 comments
Im not entirely sure but this might just be a roblox bug. I would try to just check if the speed is like 100 for like 1 second. I know a hacker would possibly go that fast but chances are they would keep running and woudnt stop.
if its on a server script walkspeed doesnt replicate, also watch out if its a local script because they usually delete the script itself if it is a server script try integrating it into an important local script so they cant just delete it with no errors for them