So this is my attempt on making a anti speed exploit (NOTE: THIS IS MY FIRST TIME DOING THIS). This is in a server script and in StarterPlayerScripts. It's not working when I go over 50 or directly on 50. Any help?
local Players = game:GetService("Players")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
while true do
wait()
if char.WalkSpeed >= 50 then
player:Kick("Exploiting")
wait(10)
end
end
end)
end)

2 comments
When exploiters speedhack, they change their WalkSpeed clientside. While the stored property value doesn't replicate to the server, their position does. There are a bunch of existing articles on exploit mitigation, I'd read into them if you want some more ideas.
Adding on, you could check for player velocity on the server to see if they're speed exploiting locally.