Anti Cheat for Beginner Developers

Not necessarily.

In many cases it’s better to have meaningful variable names, take the time to step through functions, make sure your logic is clear, etc.

Short does not always equate to efficiency.

Of course you are right. But in this case we don’t need names, just user id’s. Also ban system with names is not going to work when somebody changes their name.

1 Like

The Player Walkspeed and Jumpower values doesn’t replicate to the server

So even if you change the values on the client they will stay the same on the server

This anticheat will not work. It is a server script, but exploits change their walkspeed/jumppower on the client but not the server meaning that it will not work.
Its also extremely inefficient and will begin causing memory leaks after a player dies, eventually causing server lag.

After reviewing the code, it looks messy (for the ban system)

game:GetService("Players").PlayerAdded:Connect(function(Player)
    if Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "Atem_Pharaoh1735" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" then
        Player.CharacterAdded:Connect(function(Character)
            --credits to Ron_GM(Kayaba) for helping
            while wait(1) do
                if Character:FindFirstChildOfClass("Humanoid").WalkSpeed > 40 or Character:FindFirstChildOfClass("Humanoid").JumpPower > 50 then
                    Player:Kick("You know why. Stupid.")
                    break
                end
            end
        end)
    end
end)

I recommend you use this code provided by @BankrollAbd

Player.CharacterAdded:Connect(function(Character)
            --credits to Ron_GM(Kayaba) for helping
            while wait(1) do
                if Character:FindFirstChildOfClass("Humanoid").WalkSpeed > 40 or Character:FindFirstChildOfClass("Humanoid").JumpPower > 50 then
                    Player:Kick("You know why. Stupid.")
                    break
                end
            end
        end)

Also, as everyone said:

@hrxin Since you’re anti-cheat is SS, and the code you provided can’t do anything it’s rendered useless.

Here is what I mean (if you don’t understand what my point is.)

2 Likes

You can use my EZban module to ban people. Link to the post here: EZban ~ ban users without a hassle! - Resources / Community Resources - DevForum | Roblox

1 Like

@BankrollAbd’s code encourages banning users by username, which is bad because you can change your name to bypass it. UserIds should be the only banning method. @Jermartynojm’s code should be used.

1 Like

Then at that point you might as well not be using your method anyway, since you’d only be using UserIds and Jermartynojm’s code does that in a simpler way.

2 Likes

Why don’t you just use Find like I did. No need to loop through table.

2 Likes

i find using a function to detect it way better than table.find

2 Likes

Ok these are just your preferences. Do as you want in your code.

2 Likes

I tested it I am not dumb, It won’t ban entire server.

1 Like

No they won’t I tested it trust me, try it.

1 Like

The version that I have seen would ban everyone except banned people. We do not know how does your script works for you. You probably haven’t tested it even when you say so (or maybe you tested it changing the speed on the server instead of the client).

If you still want to use the version of the script you have now, at least kick players who are banned, like this:

game:GetService("Players").PlayerAdded:Connect(function(Player)
	if Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "Atem_Pharaoh1735" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" and Player.Name ~= "BannedPersonNameHere" then
        --[[Player.CharacterAdded:Connect(function(Character)
            --credits to Ron_GM(Kayaba) for helping
            while wait(1) do
                if Character:FindFirstChildOfClass("Humanoid").WalkSpeed > 40 or Character:FindFirstChildOfClass("Humanoid").JumpPower > 50 then
                    Player:Kick("You know why. Stupid.")
                    break
                end
            end
        end)]]
		--Will not work as exploiters change their speed locally and locally changed speed is not replicated to the server.
	else
		Player:Kick("You are banned!")
	end
end)

If I were you, I would use this script instead:

1 Like

Test it with a localscript that changes the player’s walkspeed, you will notice that the player is not kicked.

1 Like

what i know is exploiters use client sided

1 Like

Use a table, please dont use 90 or.

2 Likes

Yes, exploit script executors are client sided.

1 Like

Please read my post before replying. :arrow_up:

the only way we make an anticheat is using magnitude and cframe

1 Like