Basic Speed Anti-Exploit

Hello!

I have an Anti-speed exploit script. However I am looking to make it more secure, How can I do that?

The Code

local LPlr = game.Players.LocalPlayer
local Character = LPlr.Character
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
Humanoid.Changed:Connect(function(property) -- Detects if something in the Humanoid has been changed.
	if property == "WalkSpeed" then -- Checks if the WalkSpeed was changed
		Humanoid.WalkSpeed = 16 -- Resets it to selected number
	end
end)

Big Critique: Someone could easily

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
Char:WaitForChild("Anti-SpeedHack"):Destroy()
Char:WaitForChild("Humanoid").WalkSpeed = 100
1 Like

It is just a Basic script, but that could be overcomed if we have a script that detects if it is destroyed, and kicks the player if it is.

A more secure way would be on the server.

local last_positions = {}
local max_distance = 10 -- studs

game:GetService('RunService').Heartbeat:Connect(function()
  for i,v in pairs(game.Players:GetPlayers()) do
    if v.Character then
      local pos = v.Character.HumanoidRootPart.Position
      local last_pos = last_positions[player] -- gets where the player was last
      if last_pos then 
        local distance = last_pos.Magnitude - pos.Magnitude -- distance from then and now
        if distance > max_distance then -- if is over the max distance kick
          v:Kick('speed thingy')
        end
      end
      last_positions[v] = v.Character.HumanoidRootPart.Position
    else
      last_positions[v] = nil
    end
end)

Of course this is useless if you have stages where you fall for a large distance

destroy that one too?

Not if it is hiden well. A random name like "a021npoda21jbea41jnpj3w" could mask it.

Bruh, you could just decode it, nothing is hidden from the client, even if you parent something to nil you can still find it.

Fair point. It is intended to be a basic script, I will make a more detailed and secure one later on.

A small tip, next time use community resources as its intended use. Even a basic scripter could easily make that up, thats why most posts in this topic take up a few pages full. They are complex but are explained very well.

And for people like builders and artists or anyone that doesn’t know how to script they have no idea what this does.

I’m not trying to sound harsh here but posts like this just clutter the dev forum.

2 Likes