How to Prevent Speed Hacking

Im pretty sure that checking the rootpart’s velocity is same as the running event check except the running event only calls when the humanoid is running

Velocity and Walkspeed aren’t same thing.
Exploiters can still set Velocity and get past your anti-exploits.

You are right about it being the same. In output the same exact number for speed and magnitude

2 Likes

I wasnt mentioning walkspeed?

I have a question regarding this method.
If I were to reduce friction, would this still be a viable method?

Necropost but I’ll answer
If the player’s rootpartcframe (the torso of their body) gets to a certain area too fast it’ll say they’re hacking.
If reducing friction increases player speeds then you should change the trigger threshold.

1 Like

–[[

Made by me, do not copy.

If your game has bricks which CanCollide is false, put their names to the Allowed table.

]]

function Do(c)
a = Instance.new(“Part”,c)
a.Name = “WallHackStopper”
a.FormFactor = “Custom”
a.Size = Vector3.new(0.1,0.1,0.1)
a.Transparency = 1
a.CFrame = c.Torso.CFrame + Vector3.new(5,0,0)
weld = Instance.new(“Weld”,a)
weld.Part0 = a
weld.Part1 = c.Torso
return a
end

function Check(h)
for Index,Value in pairs(Allowed) do
if Value == h.Name then
return false
end
end
return true
end

Allowed = {“Left Leg”,“Right Leg”,“Left Arm”,“Right Arm”,“Head”,“Torso”}

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
t = Do(c)
t.Touched:connect(function(hit)
if Check(hit) == true then
c:BreakJoints()
end
end)
end)
end)
heres the better anti noclip

Code
local AllowedParts = {"Left Leg", "Right Leg", "Left Arm", "Right Arm", "Head", "Torso"}

function CreateStopper(Character)
    local Part = Instance.new("Part")
    Part.Name = "WallHackStopper"
    Part.FormFactor = "Custom"
    Part.Size = Vector3.new(0.1, 0.1, 0.1)
    Part.Transparency = 1
    Part.CFrame = Character.HumanoidRootPart.CFrame + Vector3.new(5, 0, 0)
    Part.Parent = Character

    local Weld = Instance.new("Weld")
    Weld.Part0 = Part
    Weld.Part1 = Character.Torso
    Weld.Parent = Part

    return Part
end

function Check(Part)
    for Index, Value in ipairs(AllowedParts) do
        if Value == Part.Name then
            return false
        end
    end

    return true
end

game:GetService("Players").PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        CreateStopper(Character).Touched:Connect(function(hit)
            if Check(hit) then
                Character:BreakJoints()
            end
        end)
    end)
end)

I didn’t optimize your code much(other then some bad practices), but I did make your code actually readable(it wasn’t before)

EDIT: strings had the wrong double quotes, fixed that

2 Likes

ouh ill renew the code later bc im thinking how to prevent it

You could also make a vote kick system and if you need help I have made one before and would help you.

But that can be abused very easily. Trust me, I know the Roblox community :joy:

It is true that having an anti-exploit script on the client is risky, I would personally check through the players on the server side, just to be safe. Remember: Do not trust the client!