How to make an anti-speed exploit?

So I am trying make a speed anti-exploit for my game, but the problem is I have a feature where you can dash. With that said I am trying get around without removing the dash from the game, is there a way to check what scripts made changes, or another way to get around this problem?

Create a BoolValue in the player, named BypassSpeed. When the player dashes, set this value to true. When he stops dashing, set the value to false. In your speed script, check if his location is changing by an amount you would consider to be exploiting, but also check BypassSpeed is set to false.

Now, if he is hacking, you can make the game difficult for him by putting him back to his last valid location, one that isn’t sped up, but that also takes into account if he is dashing with the bool BypassSpeed!

Hope I helped! If I did, please mark me as solution.

1 Like

Thank you for the reply :slight_smile:

1 Like

Hello, you can check their Humanoid’s WalkSpeed server-side using the Humanoid.Running event, as it exposes their locally set WalkSpeed somehow. All you wanna do is set a limit on how high it should go, though; and kill a player for exceeding the limit.

it is not just that since there are exploits that don’t rely on walkspeed to make their characters faster.

1 Like

I’m not sure how checking the WalkSpeed on the server will expose the locally set WalkSpeed? This doesn’t make sense to me but if you want to elaborate on it I would love to understand.

But @chasedig1 is right, your best bet would be to check the positions of the HumanoidRootPart on the server in time increments and measuring the Magnitude between these points such that it doesn’t exceed a reasonable distance, while checking the boolean value for a dash.

1 Like

It’s done through the Humanoid.Running event.

Reproduction code (what I use on my own game):

local Players = game:GetService"Players"

Players.PlayerAdded:Connect(function(v)
    v.CharacterAppearanceLoaded:Connect(function(c)
        local Humanoid = c:FindFirstChildOfClass"Humanoid"
        if Humanoid then
            local Connection1 ; local Connection2
            Connection1 = Humanoid.Running:Connect(function(WalkSpeed)
                if math.floor(WalkSpeed) > 16 then
                    Humanoid.Health = 0
                end
            end)
            Connection2 = Humanoid.AncestryChanged:Connect(function(_,NewParent)
                if not NewParent then
                    Connection1:Disconnect()
                    Connection2:Disconnect()
                end
            end)
        end
    end)
end)

Server Script, by the way.

What I know is that you can always record the player’s speed and then get a delta between a point in time of their speed and another point in time (basically the difference between them) and if it’s too high, you know they’re exploiting. I’m not sure how this would look most efficiently in code form but you could use Stepped or Heartbeat event.

In addition, you can do this to position to detect teleportation.

(My reply is just a way to do it without WalkSpeed since it’s possible to use a walkspeed exploit without walkspeed itself)

1 Like

If a cheater changes their walkspeed locally, the server won’t see it. You have to monitor the changes in the player’s position to determine on the server if they are moving faster than they should. In that case you would have to be aware of things that can cause false positives (falling long distances, riding in vehicles, or your sprint button).

You can check for changes in the walkspeed on the client’s side, but if an exploiter is good enough they could always just disable that.

A good option that I use would be to design your game in a way such that hacking speed or position would not be necessary or give any advantage. If your game has boundaries where you are absolutely certain a player should not be, that would make it easier to detect cheating.

1 Like

This checks the humanoid WalkSpeed on the server and not on the client, so any exploits made locally to the player will bypass.

You should test it out by setting your own WalkSpeed locally with a LocalScript and start running around in your test game before reiterating something that’s false.

1 Like

My apologies, I’ll have it tested.

1 Like

So I tested this out, and it is very efficient in detecting the humanoid walkspeed, my apologies for assuming it wouldn’t work, this is a new method I’ve never heard of.

The only flaws I noticed is that the walkspeed can still be altered by a magnitude of 1.5 without detection from the server, and that speed can be altered without the walkspeed factor, such as body forces and velocity. This is really effective for checking the walkspeed, though, I would rely on the positional differences to check the speed changes

1 Like

I’ll have to say that, it does rarely “bug”, so I would personally not rely on this method for banning players; as to avoid accidentally punishing innocent players. It is great for detecting all those typical WalkSpeed changing exploits, though.

2 Likes

Made a place file to test exploits with the exact walkspeed change detection script @StolenGeometry gave if anyone wants to test out stuff.

TestExploits.rbxl (27.5 KB)

2 Likes