Advertisement
Guest User

Anti Cheat

a guest
Sep 18th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. local Kick = false
  2. --true to kick and false to teleport back and freeze.
  3. local EndEnums, StartEnums = {
  4. Enum.HumanoidStateType.RunningNoPhysics,
  5. Enum.HumanoidStateType.Running,
  6. Enum.HumanoidStateType.Landed,
  7. Enum.HumanoidStateType.Climbing,
  8. Enum.HumanoidStateType.Seated,
  9. Enum.HumanoidStateType.Jumping
  10. }, {
  11. Enum.HumanoidStateType.Landed,
  12. Enum.HumanoidStateType.Jumping,
  13. Enum.HumanoidStateType.Freefall,
  14. Enum.HumanoidStateType.FallingDown,
  15. Enum.HumanoidStateType.RunningNoPhysics,
  16. Enum.HumanoidStateType.Running,
  17. Enum.HumanoidStateType.Climbing
  18. }
  19.  
  20. function check_enum(input, array)
  21. for i,v in pairs(array) do
  22. if input == v then
  23. return true
  24. end
  25. end
  26. return false
  27. end
  28.  
  29. function Anchored(Bool, Root)
  30. for i,v in pairs(Root.Parent:GetDescendants()) do
  31. if v:IsA'BasePart' then
  32. v.Anchored = Bool
  33. end
  34. end
  35. end
  36.  
  37. game.Players.PlayerAdded:connect(function(p)
  38. p.CharacterAdded:connect(function(c)
  39. local t, h = c:WaitForChild'HumanoidRootPart', c:WaitForChild'Humanoid'
  40. local running = false
  41.  
  42. h.StateChanged:connect(function(state)
  43. if check_enum(state, StartEnums) and not running then
  44. running = true
  45. local start, EndLoop, pos = tick(), false, t.Position
  46. local died
  47. died = h.Died:Connect(function()
  48. EndLoop = true
  49. died:Disconnect()
  50. end)
  51. --print('start', h:GetState())
  52. while wait(.1) do
  53. local Lstate = h:GetState()
  54. if tick()-start > .5 then
  55. if t.Position.Y-pos.Y > 25 then
  56. --print('Jump hieght: ',t.Position.Y-pos.Y)
  57. if Kick then
  58. p:Kick'Exploiting is not tolerated.'
  59. EndLoop = true
  60. else
  61. t.CFrame = CFrame.new(pos-Vector3.new(0,2,0))
  62. wait()
  63. Anchored(true, t)
  64. wait(5)
  65. Anchored(false, t)
  66. EndLoop = true
  67. end
  68. end
  69. end
  70.  
  71. if check_enum(Lstate, EndEnums) or EndLoop then
  72. --print('LoopEnd', ' ~~ Air time: ', tick()-start)
  73. running = false
  74. died:Disconnect()
  75. break
  76. end
  77. end
  78. end
  79. end)
  80. end)
  81. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement