In my games, walk speed is an important part, but some hackers hack their walk speed and make other players have a hard time in the challenge! Even if they change their speed client side, their position is what matters on the server side, so they get past FilteringEnabled.
I know a way is checking each player locally, because you know, their speed is local but I wanted to ask if there is a known and a better way to do this because checking is done every couple seconds while I need it always checked.
Make sure they don’t move to places too fast on the server. E.g. if it should take about 10 seconds to get from point A. to point B. but they make it there in 5, you will know they’re exploiting.
Check on the server to see if the player is moving too fast via. magnitude checks between last and new position. It also wouldn’t hurt to check if the client has over 61 FPS, although this cap could be raised in the future presenting a problem.
Crude example (not tested):
local function trackPlr(character)
local torso = character:WaitForChild("UpperTorso")
local humanoid = character:WaitForChild("Humanoid")
local lastPos = torso.CFrame.p
repeat
wait(1)
if((lastPos-torso.CFrame.p).magnitude > humanoid.WalkSpeed*2) then
print("Player might be speed hacking")
humanoid.Health = 0
else
lastPos = torso.CFrame.p
end
until character.Parent == nil or humanoid.Health <= 0
end
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
trackPlr(char)
end)
end)
Although checking time taken between points, don’t just immediately ban. I’d teleport them to a better position based on speed. Then perhaps have logs that flag users if they have done it way too many times. Especially because you never know if a physics bug will happen
Checking the actual velocity every few seconds is far too broad in my opinion and doesn’t account for physics glitches.
You can check the player’s Walkspeed without having to check every few seconds. Why not just use Changed to run a check only when the Walkspeed is edited?
Granted, I’m not educated on ROBLOX hacks, so if there’s a hack that lets you delete LocalScripts, it makes sense to go for a server-side solution as many have proposed. But if OP’s only problem is that he needs to keep track of Walkspeed constantly, then using Changed suffices.
It’s a good prototype, but looking at it I can already see some key issues. If you fall from a high building you might get pinged as an exploiter, and killed.