How to make a anti exploit with tables

Alright so i have been thinking how to make the most efficient way to make a anti-exploit and that’s when tables came into my head.

What i mean is this:

local Requirments = {
Humanoid = true,
WalkSpeed = 16,
JumpPower = 50

}

Then we could do a loop and whenever a players humanoid is false (meaning they dont have a humanoid) it will kick them.

I just dont know how to peform this action.

Use player added event, and then use a for loop. Walkspeed doesn’t replicate from client to server so you are better off checking the velocity or the distance the player travelled from point A to point B.

Same goes for the jump power, it doesn’t replicate.

Never trust the client and always do anti exploit stuff on the server. A exploiter can just simply modify or delete the local script since it runs on their end.

You shouldn’t be harsh on exploiters until they really are causing havoc.

Here’s a simple demonstration.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        -- for loop that loops through each player
    end)
end)

Your game should be made in a way where speed and jump hacks are reducant.

Umm you can’t detect if humanoid is doesn’t exist

because it will just be got destroy and creating new when player respawning
if you do like that player will just got kick with no reason.

Completed script: i guess?

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char) 
died = false
char.Humanoid.Died:Connect(function() 
died = true
		end)
		print('done')
repeat wait() while wait() do if char.Humanoid.WalkSpeed ~= 16 then plr:Kick("Why cheating bro") end if char.Humanoid.JumpPower ~= 50 then plr:Kick("Why you keep cheating") end -- <add more here! end until died == true
end)
end)

is done script

NOTE: Please make sure there is nothing that will decrease/increase player walk speed or jump power because this can’t know if it was done by who.

you can add more like maxhealth etc.
by using

if char.Humanoid.WalkSpeed ~= 16 then plr:Kick("Why cheating bro") end -- Change walk speed to property on humanoid you want! and change 16 to value that must be, see above then you will know where you should put it

Learn more about if statement if you wanna add more feature by click this

If you don’t understand you can let me know :slight_smile:
Have a nice day and sorry for bad english.

How would that work?, woulden’t the server detect wrong because the walkspeed was changed on the client.

oh ok let me change it wait…

so create LocalScript on StarterPlayerScripts in StarterPlayer


local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char) 
died = false
char.Humanoid.Died:Connect(function() 
died = true
		end)
		print('done')
repeat wait() while wait() do if char.Humanoid.WalkSpeed ~= 16 then plr:Kick("Why cheating bro") end if char.Humanoid.JumpPower ~= 50 then plr:Kick("Why you keep cheating") end -- <add more here! end until died == true
end)

and how to add more protection is same with above

have a nice day and sorry for bad english

An exploiter can just delete the local script…

this is just first protection…

Then what is the advanced protection?

i don’t know…

i just beginner so sorry

maybe someone else will help you about this later i guess ??

Okay… Thank u for your help i guess…

How would i get the players jump power or walk speed then?

You don’t. Just check if the player is going too fast either by checking their velocity or the distance they traveled from Point A to Point B.

For jump power, use humanoid state changed events.

Could u possibly show a demonstration?