I want to detect if the player is hacking by checking their speed from the server

So if you were in my place what would you do in order to avoid these exploiters?

Find the player’s position at a given time and compare it to their position after a few seconds. Kick them if the distance between both positions is too big.

then use another script where the script looks normal but the script about 50000 lines later there will be a line where it fires a remote or a property change theb kick them the only possible but stupid way

Think Like Exploiters

I am sorry but that is not efficient enough or not at all because they can change the speed to a good amount and move in batches in order to avoid that

sometimes if player has massive lag them the server might think its teleporting so its not a good way

At best, they could only move as fast as you want them to move, but whatever. Use whatever method you want.

1 Like

What? No. He is saying the correct way to do it. Because of metatables, exploiters can make sure the client doesn’t see what the actual WalkSpeed is.

2 Likes

The only possible way for antiexploit is call the roblox staff or someone and ask them to improve roblox security as they say “kids game must have security” they do but only for chat but not account security or exploit security i just cant understand roblox

Or… create an anti-exploit that’s not use the client at all…

which is impossible…

Not true. I made one a few months ago without even a year of coding experience.

1 Like

It would be great if u could share it with us and it would also help to get the proper way

1 Like

If they disable the script then server will not get any replies. If that happens kick the client simple. It’s not completely flawless but it will definitely take time to crack. Probably it might slow down the exploiter by about an hour.

If you make an intricate system with uses formulas and encryption use randomly timed FireAllClients and use multiple unreadable scripts the exploiter will have a hard time making an exploit. Nothing is ever perfect all you can do is slow them down.

v = x/t. x = the displacement (distance between both points) and t = time. WalkSpeed is the velocity that the player is moving at. Using this we can create a simple script that checks the velocity. If the velocity is higher than the WalkSpeed then we want to kick the player.

Example (sorry about the bad formatting)
local players = game:GetService("Players")

local waitTime = .5
local maxSpeed = 18

players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local rootPart = character:WaitForChild("HumanoidRootPart")
        local humanoid = character:WaitForChild("Humanoid")
        local lastPosition = nil
    
        wait(3) -- delays so it doesn't spike at the beginning
        while wait(waitTime) do
            if not lastPosition and rootPart then
                lastPosition = rootPart.Position
            elseif lastPosition and rootPart and humanoid.Health > 0 then
               local position = rootPart.Position*Vector3.new(1, 0, 1)
               local magnitude = math.round((lastPosition - position).Magnitude/waitTime)
            
            print(magnitude)
            
            if magnitude > maxSpeed then
                player:Kick()
            end

            lastPosition = position
            end
        end
    end)
end)
3 Likes

Thanks for the help.
I can’t really get the math there though where you are rounding up the result of the subtraction of position from the last position and dividing by the wait time.
Can you take some time to explain it?
Thanks again.

best way to do this is ditch the client. What you should do is have magnitude checks, and reset each position every time the player dies. If a player goes out of their limit, correct their position. This also acts as a anti-fling and teleportation script

1 Like

Since velocity = x (distance between both points) / t (time taken between both points). We can plug in the variables with our values.

To find x, we need to identify the two positions. We also want to remove the Y-axis since it’s not affected by running.

local pointA = Vector3.new(32, 8, 29)*Vector3.new(1, 0, 1)
local pointB = Vector3.new(47, 8, 52)*Vector3.new(1, 0, 1)
-- in the other code, the variables are lastPosition and position

Once that’s done, we must find the distance between both points. I rounded it so that it would somewhat match the WalkSpeed. Flooring it might make it identical, but I haven’t tested that.

local magnitude = math.round((pointA - pointB).Magnitude)
-- this is x

Now we can plug the variables into the formula

local velocity = magnitude/overallTime -- if checking every 0.1 second, make this 0.1
-- if you use this in a while wait() loop, make the overallTime be the number in the wait()
2 Likes

Thanks for the clear explanation!

WalkSpeed changes from the client aren’t replicated to the server.

Making an intricate system with random forums and encryption is defeated if the exploiter makes their own script to send information back when the call is sent. Do not trust the client when designing an anti exploit system.