Simple Anti-Exploit not working

I had the script working but the script was very long and for something this simple having a super long script for that is just unnessacory so I tried making it better and much shorter, but it did not work and now it does not work at all. I am not a scripter and I know very little to nothing about scripting.

This is a LocalScript placed inside of "StarterCharacterScripts"

local Hum = script.Parent:WaitForChild("Humanoid")

local WS = Hum.WalkSpeed >= 18
local JP = Hum.JumpPower >= 55

while true do
	if WS or JP then
		game.Players.LocalPlayer:Kick("Kicked due to unexpected client behavior")


You’re making the assignment WS = Hum.WalkSpeed >= 18 only once, before the while-loop is running. Same with JP. Thus, every time you check if WS or JP then... it’s reading the variables as if false or false then... and won’t evaluate true.

I would create the variables WS,JP outside of the loop, but reassign them each iteration in the loop (like WS = Hum.WalkSpeed >= 18 after your wait(5)) so that if the value changes after the first assignment, the boolean may become true.

Do bear in mind that from an anti-exploit standpoint, this is running on the client, and they have full replication of this script. They can simply disable any anti-exploit being ran by themselves.

1 Like

If I put the lines from 6-7 “while true do wait(5)” above the local WS would that fix the issue? Also, this script is just one of them in place to prevent exploiting I have a few others which when I fix and finish all the scripts related to exploring Imma find players from a discord server or group recruiting plaza to see if they can bypass my anti exploits.

Edit: Yup it works now :smiley: Thank you for helping.