So, I am making an anti-hack script. But, it doesn't work. It looks like there are no typo's, and there are no errors(underlined red). But, in the output, it says:
10:59:56.639 - ServerScriptService.Anti Hack:2: attempt to index local 'plr' (a nil value)
, also, when I change the game.Workspace gravity to 0 while testing, it doesn't turn it back to 196.2. Any help is appreciated. Here's the script:
local plr = game.Players.LocalPlayer
local plrc = plr.Character.Humanoid
local admins = {"noob"} -- People who don't get kicked.
debounce = true
for i=1, #admins do
if game.Players.LocalPlayer == admins[i] then
debounce = false
end
end
if not plrc.WalkSpeed == 16 or not plrc.JumpPower == 50 then
local msg = Instance.new("Hint", workspace)
msg.Text = "Exploiter Detected! Kicking..."
plr:Kick("nice dirty hacks lol")
wait(5)
msg:Destroy()
end
if workspace.Gravity == not 196.2 then
workspace.Gravity = 196.2
end

1 comment
this script wouldn't work if filtering enabled was on, because walkspeed would still show as 16. i think you should detect the velocity of the torso or something like that. this doesn't mean that you shouldn't use fe, i encourage you to use it since the game will be way more secure