I’m currently messing around with some ways to secure my anti cheat to detect such things as speed hacks, jump hacks, etc. And here’s some code inside of a local script to detect a sudden change in a player’s walkspeed:
local Humanoid = script.Parent:WaitForChild("Humanoid");
Humanoid.Changed:Connect(function()
game.ReplicatedStorage.CheckForCheat:FireServer(Humanoid.WalkSpeed)
end)
Basically, everytime a property is changed inside of the humanoid, the script will fire a remote event along with the player’s walkspeed. Once a server script receives the fired event, it will check to see if the walkspeed value went over the walk speed limit:
game.ReplicatedStorage.CheckForCheat.OnServerEvent:Connect(function(player, WalkSpeed)
if WalkSpeed ~= 16 then
player:Kick();
end
end)
And if the value is above the walk speed limit, the server will kick the player. And now I’m wondering, is this a good way to secure my anti cheat? Can exploiters abuse this in a way so they don’t get kicked by the server?
If I’m correct, Filtering Enabled makes it so all actions the exploiter does inside of the workspace only changes for them and not for the entire server.
To put this bluntly this won’t really prevent a client from adjusting their speed. This is because the local script can just be deleted and thus won’t trigger your anti exploit.(It can also be spoofed by Metatables)
However, if you are adamant about having walk speed detection you could move all these checks onto the Server and use math to figure out if a client is moving too fast this would bypass the whole client side mess. This has its own set of pros/cons and ill let you do the research to figure out if its even worth it.
This is correct most of the time any change a client does locally will not replicate. However because the player is given Network Ownership of their character they are free to modify values such as speed/health and it will replicate to the server. You can read about Network Ownership here
Network ownership is related to physics not values. Health changes don’t replicate to the server and neither does WalkSpeed. The reason an exploiter can change their WalkSpeed and still move faster is because WalkSpeed influences the movement velocity of the character which is physics related and thus, due to network ownership, does replicate.
Checking WalkSpeed is always a poor way to check for speed exploits. The server should instead be more attentive on the client’s physics. Additionally, the way OP is doing it is just not good at all contrary to the appraisals in this thread. Relying on the client to fire a RemoteEvent is bad (they can just terminate the connection) and it’s bad to check changes to properties irrelevant to your system.
It doesn’t. Relying on an event to Fire when the client’s Humanoid Walk speed is changed isn’t reliable. They could delete the connection and the script in general. A better way to go about this would be to check the player’s velocity, as attempting to check the Walk speed could give you improper results. They can set their WalkSpeed to 16 but in reality, it’s probably 99999.