FlyingFrog

Untitled

Aug 5th, 2025
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.19 KB | Gaming | 0 0
  1. local PushHandler = {}
  2.  
  3. local Debris = game:GetService("Debris")
  4. local Players = game:GetService("Players")
  5. local Ragdoll = require(game.ServerScriptService:WaitForChild("RagdollModule"))
  6.  
  7. function PushHandler.PushPlayer(tool, player, target, mouseCFrame, damage, reload, ragdollReload)
  8.     if not tool.Enabled then return end
  9.     tool.Enabled = false
  10.  
  11.     local targetChar = target and target.Parent
  12.     if not targetChar then return end
  13.  
  14.     local humanoid = targetChar:FindFirstChildWhichIsA("Humanoid")
  15.     local root = targetChar:FindFirstChild("HumanoidRootPart")
  16.  
  17.     if humanoid and root and humanoid.Health > 0 then
  18.         local force = tool:FindFirstChild("PushForce") and tool.PushForce.Value or 100
  19.  
  20.        
  21.         root:SetNetworkOwner(nil)
  22.         root.Velocity = mouseCFrame.LookVector * force
  23.         humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  24.  
  25.        
  26.         local animate = targetChar:FindFirstChild("Animate")
  27.         if animate then
  28.             animate.Disabled = true
  29.         end
  30.  
  31.        
  32.         humanoid:ChangeState(Enum.HumanoidStateType.Physics)
  33.  
  34.        
  35.         Ragdoll.EnableRagdoll(targetChar)
  36.  
  37.        
  38.         task.delay(ragdollReload.Value, function()
  39.             Ragdoll.DisableRagdoll(targetChar)
  40.         end)
  41.  
  42.         local animate = targetChar:FindFirstChild("Animate")
  43.         if animate then
  44.             animate.Disabled = false
  45.         end
  46.  
  47.        
  48.         local tag = Instance.new("ObjectValue")
  49.         tag.Name = "creator"
  50.         tag.Value = player
  51.         tag.Parent = humanoid
  52.         Debris:AddItem(tag, 5)
  53.  
  54.        
  55.         if not humanoid:FindFirstChild("DiedConnected") then
  56.             local diedFlag = Instance.new("BoolValue")
  57.             diedFlag.Name = "DiedConnected"
  58.             diedFlag.Parent = humanoid
  59.  
  60.             humanoid.Died:Connect(function()
  61.                 local killerTag = humanoid:FindFirstChild("creator")
  62.                 if killerTag and killerTag.Value and killerTag.Value:FindFirstChild("leaderstats") then
  63.                     local killer = killerTag.Value
  64.                     local kills = killer.leaderstats:FindFirstChild("Kills")
  65.                     local achievements = killer:FindFirstChild("Achievements")
  66.  
  67.                     if kills and achievements then
  68.                         kills.Value += 1
  69.  
  70.                         for _, achievement in ipairs(achievements:GetChildren()) do
  71.                             local match = string.match(achievement.Name, "^Убить (%d+) человек$")
  72.                             if match then
  73.                                 local requiredKills = tonumber(match)
  74.                                 if requiredKills and kills.Value >= requiredKills and achievement:IsA("BoolValue") and not achievement.Value then
  75.                                     achievement.Value = true
  76.                                 end
  77.                             end
  78.                         end
  79.                     end
  80.                 end
  81.             end)
  82.         end
  83.  
  84.        
  85.         humanoid:TakeDamage(damage.Value)
  86.  
  87.        
  88.         local targetPlayer = Players:GetPlayerFromCharacter(targetChar)
  89.         if targetPlayer then
  90.             root:SetNetworkOwner(targetPlayer)
  91.         end
  92.  
  93.        
  94.         local sounds = tool:FindFirstChild("PushSounds")
  95.         if sounds and #sounds:GetChildren() > 0 then
  96.             local chosen = sounds:GetChildren()[math.random(1, #sounds:GetChildren())]:Clone()
  97.             chosen.Parent = player.Character:FindFirstChild("HumanoidRootPart")
  98.             chosen.PlayOnRemove = true
  99.             chosen:Destroy()
  100.         end
  101.  
  102.        
  103.         local pushes = player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("pushed")
  104.         if pushes then
  105.             pushes.Value += 1
  106.         end
  107.     end
  108.     print(reload.Value)
  109.     task.delay(reload.Value, function()
  110.         tool.Enabled = true
  111.     end)
  112. end
  113.  
  114. return PushHandler
  115.  
Advertisement
Add Comment
Please, Sign In to add comment