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

Anti-Exploit Preventer Script Not Working? Please Help! Errors?

Asked by 6 years ago

Just something I wanted to try, but now it breaks the script. I want to add an admin list so that only these players are able to use these exploits.

me = script.Parent:FindFirstChild("Humanoid")

admins = {"LukeGabrieI", "RAMD0", "Player1", "zCamm", "zMamii", "spikeIee", "ajman37", "axdymaivo",
"NyalonTheFine", "ajman37"}

TestCounter = 0
lastTime = 0


function checkstate(state)

    --anti infinite jump checker
    if state == Enum.HumanoidStateType.Seated then
        if admins then
            return nil
        end
    else
        if lastTime > os.time() - 1 then
            TestCounter = TestCounter + 1

            if TestCounter > 2 then
                --kill player
                me.Health = 0
                print(me.Parent.Name .. ", you were just caught jump hacking. :)")
            end
        else
            lastTime = os.time()
            TestCounter = 0
        end
    end

    --anti fly checker  
    if state == Enum.HumanoidStateType.Flying then
        if admins then
            return nil
        end
    else
        me.Health = 0
        print(me.Parent.Name .. ", you were just caught flying. How did you do that? :)")
    end

    --anti speed walking
    if me.WalkSpeed > 16 then
        if admins then
            return nil --[[I actually don't know what to put here, just something I tried, but now I'm just
            dieing all the time.--]]
        end
    else
        me.Health = 0
        print(me.Parent.Name .. ", you were caught Speed Hacking. :)")
    end
end

me.StateChanged:Connect(checkstate)
0
Is this a local script? User#2146 0 — 6y
0
Yes LukeGabrieI 73 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Notes:

  • I would expect that Roblox would want to ban players using exploits, and so would not recommend attempting to support letting some players use them. Instead, simply give your admins special powers, supported by legitimate scripts (ex give them the ability to run/fly using tools).
  • In the comments you mention that this is a LocalScript. Some exploiters/hackers will be able to simply remove this "anti-exploit" script. Fortunately there's nothing that your script does that inherently requires it to be on the client (though you will need more complexity to handle multiple players).
  • You have a bug: I think you need to move line 47 to after line 50 (the else should probably only run if the person is actually moving faster than 16).
  • I believe that one exploit is to cause the client to think that time is going faster than it actually is, allowing a user to run faster than they're supposed to be able to. Looking at WalkSpeed won't help with that - you need to actually track how quickly they're moving over time (and then make sure you aren't going to hurt players who simply fell down a cliff, experienced a physics glitch, etc).
  • In your code you use if admins then return end, but this will always occur because admins is a table and all non-nil non-false values/objects are considered "true" in lua.

Nonetheless, to do what you want, you need to check to see if the local player is in the 'admins' list. If it's going to stay a LocalScript, perhaps create an isAdmin variable right after the admins = line, use a for loop to go through the list and see if the player is an admin, and then only run line 54 if the player is not an admin. You can then remove the 'admin' logic you put throughout the function and keep the function simple.

If you will make it a Script (not LocalScript), then I you should convert the admins list to a dictionary so that you can do things like if admins[player.Name] then return end, or if not admins[player.Name] then --[[connect events like normal here]] end

Ad

Answer this question