My anti-speed exploit is crashing me every time when I test it out and I have no idea why...
wait(1) local WalkspeedHackPrevent = true local WalkspeedMax = tonumber("18") local Plr = game.Players.LocalPlayer local Char do repeat wait(1) until Plr.Character ~= nil Char = Plr.Character end local Hum do repeat wait(1) until Char:FindFirstChild("Humanoid") Hum = Char.Humanoid end while true do if WalkspeedHackPrevent then if Hum.WalkSpeed > WalkspeedMax then Plr:Kick("Exploiter detected in the server") end end end
Replace "while true do" with "while wait() do" on line 13.
I can't really explain correctly why, someone else may be able to, but this should prevent it from crashing.
The last while loop does not have a wait(1)
. Also you should use WaitForChild()
instead:
wait(1) local WalkspeedHackPrevent = true local WalkspeedMax = 18 local Plr = game.Players.LocalPlayer local Char do repeat wait(1) until Plr.Character ~= nil Char = Plr.Character end local Hum = Char:WaitForChild("Humanoid") while wait() do if WalkspeedHackPrevent then if Hum.WalkSpeed > WalkspeedMax then Plr:Kick("Exploiter detected in the server") end end end
But since this is local, hackers might remove this script. You might want to have a server script do this. Sorry if this confuses you.