Advertisement
szze

Clone AntiCheat

Dec 30th, 2022
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.90 KB | None | 0 0
  1. local PhysicsService = game:GetService("PhysicsService")
  2. local PlayerGroup = PhysicsService:CreateCollisionGroup("p")
  3.  
  4. PhysicsService:CollisionGroupSetCollidable("p","p",false)
  5.  
  6. function NoCollision(Model)
  7.     for k,v in pairs(Model:GetChildren()) do
  8.         if v:IsA("BasePart") then
  9.             PhysicsService:SetPartCollisionGroup(v,"p")
  10.         end
  11.     end
  12. end
  13.  
  14. game:GetService("Workspace").ChildAdded:Connect(function(Child)
  15.     if Child and Child:FindFirstChild("HumanoidRootPart") then
  16.         NoCollision(Child)
  17.     end
  18. end)
  19.  
  20. players = game:GetService('Players')
  21.  
  22. players.PlayerAdded:Connect(function(plr)
  23.     plr.CharacterAdded:Connect(function(character)
  24.         repeat
  25.             task.wait()
  26.         until character.PrimaryPart
  27.         character.Archivable = true
  28.         local clonedCharacter = character:Clone()
  29.         local clonedHumanoid = clonedCharacter.Humanoid
  30.         clonedHumanoid.WalkSpeed = 22
  31.         clonedCharacter.Parent = workspace
  32.         for i, v in next, clonedCharacter:GetChildren() do
  33.             if v:IsA('BasePart') then
  34.                 v.CanCollide = false
  35.             end
  36.         end
  37.         plr.CharacterRemoving:Connect(function()
  38.             clonedCharacter:Destroy()
  39.         end)
  40.         while task.wait((clonedHumanoid.WalkSpeed + (math.round(clonedHumanoid.WalkSpeed/character.Humanoid.WalkSpeed)) + 1) / (clonedHumanoid.WalkSpeed) / 1.5) do
  41.             clonedHumanoid:ChangeState('Running')
  42.             if (clonedCharacter.Humanoid.RootPart.Position - character.Humanoid.RootPart.Position).Magnitude > (clonedHumanoid.WalkSpeed / character.Humanoid.WalkSpeed) * (character.Humanoid.WalkSpeed) then
  43.                 task.spawn(function()
  44.                         for i = 0, 20 do
  45.                             character.Humanoid.RootPart.CFrame = CFrame.new(clonedCharacter.Humanoid.RootPart.Position)
  46.                             task.wait()
  47.                         end
  48.                     character.Humanoid.RootPart:SetNetworkOwner(nil)
  49.                     task.wait(2.5)
  50.                     character.Humanoid.RootPart:SetNetworkOwner(plr)
  51.                     end)
  52.                 end
  53.             clonedHumanoid.RootPart.CFrame = CFrame.new(character.Humanoid.RootPart.Position)
  54.         end
  55.     end)
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement