Just something I wanted to try, but now it breaks the script. I want to add an admin list so that only these players are able to use these exploits.
me = script.Parent:FindFirstChild("Humanoid") admins = {"LukeGabrieI", "RAMD0", "Player1", "zCamm", "zMamii", "spikeIee", "ajman37", "axdymaivo", "NyalonTheFine", "ajman37"} TestCounter = 0 lastTime = 0 function checkstate(state) --anti infinite jump checker if state == Enum.HumanoidStateType.Seated then if admins then return nil end else if lastTime > os.time() - 1 then TestCounter = TestCounter + 1 if TestCounter > 2 then --kill player me.Health = 0 print(me.Parent.Name .. ", you were just caught jump hacking. :)") end else lastTime = os.time() TestCounter = 0 end end --anti fly checker if state == Enum.HumanoidStateType.Flying then if admins then return nil end else me.Health = 0 print(me.Parent.Name .. ", you were just caught flying. How did you do that? :)") end --anti speed walking if me.WalkSpeed > 16 then if admins then return nil --[[I actually don't know what to put here, just something I tried, but now I'm just dieing all the time.--]] end else me.Health = 0 print(me.Parent.Name .. ", you were caught Speed Hacking. :)") end end me.StateChanged:Connect(checkstate)
Notes:
else
should probably only run if the person is actually moving faster than 16).WalkSpeed
won't help with that - you need to actually track how quickly they're moving over time (and then make sure you aren't going to hurt players who simply fell down a cliff, experienced a physics glitch, etc).if admins then return end
, but this will always occur because admins
is a table and all non-nil non-false values/objects are considered "true" in lua.Nonetheless, to do what you want, you need to check to see if the local player is in the 'admins' list. If it's going to stay a LocalScript, perhaps create an isAdmin
variable right after the admins =
line, use a for
loop to go through the list and see if the player is an admin, and then only run line 54 if the player is not an admin. You can then remove the 'admin' logic you put throughout the function and keep the function simple.
If you will make it a Script (not LocalScript), then I you should convert the admins
list to a dictionary so that you can do things like if admins[player.Name] then return end
, or if not admins[player.Name] then --[[connect events like normal here]] end