Is there a way that I can check if the server has changed the players walkspeed, rather than the client? I need this for an anti-exploit I am making for my game.
Thanks, I’ll test it now!
EDIT: But wouldn’t this be fairly easy to bypass? An exploiter could just delete the localscript and execute a script that returns a valid walkspeed.
You can either trust the client to send valid data to the server with remote events and compare the value seen on the client with the value seen on the server, the only problem with this is that exploiters are able to stop and alter data being sent to the server. If you wanted to do it this way, do it as @Flubberlutsch has suggested (though you may want to provide some leniency with the comparison of floating point numbers).
Otherwise, if you want it all done serversided then try this, it’s by no means perfect but it’s something you could work from:
What if the server were to set the users walkspeed?
Oh okay, thanks!
Might this affect things like users being low to the ground with highspeed body movers being acted on them?
If you’re typing out multi-line code, surround it with a pair of “```
”'s so that it’s formatted properly:
```
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild(“Humanoid”)
hum.Running:Connect(function(speed)
if speed > hum.WalkSpeed + 1 then
player:Kick(“Nice exploit.”)
end
end)
end)
end)
```
I’m not 100% sure but the wiki makes it seem like the value sent is the walkspeed and not the actual speed of the character. I’m not sure how easy it would be for the client to spoof that value though.
Not entirely sure if it’s possible to spoof, but I was printing the speed
parameter passed to the event and it was actually the magnitude of the velocity for on X and Z axis. I tried this method and got kicked when a part tripped my character so it certainly has some false-positives.
It also could have some false-positives when the server actually teleports the player and probably during temporary network failure, I’ve played games that aren’t lag tolerant and kicked me. You may be thinking that latency is not common, I can assure you it’s more common than exploiters.
@Maximum_ADHD Wiki needs updated. This wording seems wrong:
When the Humanoid begins walking, this event fires. In this case, speed is the Humanoid’s WalkSpeed.