Advertisement
_Thanh_Thy_Cute_

Fling Things and People ANTI FLING

Sep 21st, 2021
3,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. --[[ Variables ]]
  2. local PS = game:GetService("Players")
  3. local RS = game:GetService("ReplicatedStorage")
  4. local RunService = game:GetService("RunService")
  5. local StruggleEvent = RS:WaitForChild("Struggle")
  6. local GameMt = getrawmetatable(game)
  7. setreadonly(GameMt, false)
  8. local OldNameCall = GameMt.__namecall
  9. local OldIndex = GameMt.__index
  10.  
  11. GameMt.__index = function(Self, Key)
  12. if not checkcaller() and Self and Key == "Sit" then
  13. return false
  14. end
  15. return OldIndex(Self, Key)
  16. end
  17.  
  18. GameMt.__namecall = newcclosure(function(Self, ...)
  19. local Args = {...}
  20. local NameCallMethod = getnamecallmethod()
  21.  
  22. if not checkcaller() and NameCallMethod == "SetStateEnabled" and Args[2] == false then
  23. Args[2] = true
  24. return OldNameCall(Self, ...)
  25. end
  26.  
  27. return OldNameCall(Self, ...)
  28. end)
  29.  
  30.  
  31.  
  32. setreadonly(GameMt, true)
  33.  
  34. TeleportingBack = false
  35. Distance = 0
  36. function AntiThrow()
  37. local Character = PS.LocalPlayer.Character or PS.LocalPlayer.CharacterAdded:Wait()
  38. local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
  39. local Head = Character:WaitForChild("Head")
  40. local Humanoid = Character:WaitForChild("Humanoid")
  41. local HeadConnection;
  42. local CharacterConnection;
  43.  
  44. HeadConnection = Head.ChildAdded:Connect(function(A)
  45. if A.Name == "PartOwner" then
  46. if A.Parent ~= nil then
  47.  
  48. spawn(function()
  49. while wait() do
  50. if A.Parent ~= nil then
  51. StruggleEvent:FireServer(PS.LocalPlayer)
  52. elseif A.Parent == nil then
  53. break
  54. end
  55. end
  56. end)
  57.  
  58. local CurrentPosition = Character.HumanoidRootPart.CFrame
  59. local LastPosition;
  60.  
  61. while wait() do
  62. if A.Parent ~= nil then
  63. --[[ Local Variables ]]
  64. LastPosition = Character.HumanoidRootPart.CFrame
  65. Distance = (CurrentPosition.Position - LastPosition.Position).magnitude
  66. elseif A.Parent == nil then
  67. if Distance > 1 and TeleportingBack == false then
  68. print("Limit reached")
  69. TeleportingBack = true
  70. spawn(function()
  71. local RenderSteppedLoop;
  72. RenderSteppedLoop = RunService.RenderStepped:Connect(function()
  73. if TeleportingBack == true then
  74. print("StrafingNoPhysics")
  75. Humanoid:ChangeState(Enum.HumanoidStateType.StrafingNoPhysics)
  76. elseif TeleportingBack == false then
  77. RenderSteppedLoop:Disconnect()
  78. end
  79. end)
  80. end)
  81. for TP = 1, 5 do
  82. wait(.3)
  83. Character.HumanoidRootPart.CFrame = CurrentPosition
  84. end
  85. TeleportingBack = false
  86. end
  87.  
  88. --[[ Reset distance ]]
  89. Distance = 0
  90. break
  91. end
  92. end
  93.  
  94. end
  95. end
  96. end)
  97.  
  98. CharacterConnection = PS.LocalPlayer.CharacterRemoving:Connect(function()
  99. HeadConnection:Disconnect()
  100. CharacterConnection:Disconnect()
  101. end)
  102.  
  103.  
  104. end
  105.  
  106. AntiThrow()
  107.  
  108. PS.LocalPlayer.CharacterAdded:Connect(function()
  109. repeat wait() until PS.LocalPlayer.Character:FindFirstChild("Head")
  110. AntiThrow()
  111. end)
  112.  
  113. print("Antifling loaded!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement