Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For loop to check for increased walkspeed doesnt work?

Asked by 4 years ago

I'm trying to make an AntiCheat system, but nothing happens when I increase my WalkSpeed.

01for i, player in pairs(game.Players:GetPlayers()) do
02    wait(timeBetweenScans)
03    local cheaters = {}
04    if outputInfo == true then
05        print("Performing a Cheat Scan...")
06    end
07    if antiSpeed == true then
08        if player.Character.Humanoid.WalkSpeed > maxSpeed then
09            player:Kick(speedReason)
10        end
11    end
12    if antiJump == true then
13        if player.Character.Humanoid.JumpPower > maxJump then
14            player:Kick(jumpReason)
15        end
View all 25 lines...
0
Unused variable 'cheaters', recommend to remove it antoniorigo4 117 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hello there! I believe the current state of your script will only perform at the beginning of the game. What you may want to do is add a while loop before the for loop, so it is checking constantly.

01while wait(0.1) do
02    for i, player in pairs(game.Players:GetPlayers()) do
03        local cheaters = {}
04        if outputInfo == true then
05                print("Performing a Cheat Scan...")
06            end
07            if antiSpeed == true then
08                if player.Character.Humanoid.WalkSpeed > maxSpeed then
09                    player:Kick(speedReason)
10                end
11            end
12            if antiJump == true then
13                if player.Character.Humanoid.JumpPower > maxJump then
14                    player:Kick(jumpReason)
15                end
View all 26 lines...

Let me know if this works. You can also try using PropertyChangedSignal to see when the humanoid's properties change value. Read more about it here: (http://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal)

Ad
Log in to vote
0
Answered by
ew_001 58
4 years ago
Edited 4 years ago

Remember, a server script can not see if you are changing walk speed on the client, it will remain the same for the server.

To fix this, change this into a local script, that only checks on the local player. But this comes with a problem, the exploiter can disable the local script.

But the local script can still catch most exploiters if they don not see the local script.

A tip on disguising the local script is by renaming to someting else then "AntiCheat" or "AntiExploit", and do not rename it to like someting wierd or scrambled, because thats suspicious.

Rename it to like "ClientReplicator" or "ClientMethods".

I hope this helps!

Answer this question