Advertisement
Guest User

Server

a guest
Mar 28th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. local debris = game:GetService("Debris")
  2. local events = {}
  3. local playerdb = {}
  4.  
  5. game.ReplicatedStorage.Remotes.Kicking.OnServerEvent:Connect(function(player)
  6.     if not playerdb[player] then
  7.         playerdb[player] = true
  8.         coroutine.resume(coroutine.create(function()
  9.             wait(2.8)
  10.             playerdb[player] = false
  11.         end))  
  12.         local character = player.Character
  13.         if not character or character.Humanoid.Health <= 0 then return end
  14.         local left = game.ReplicatedStorage.LegHitbox:Clone()
  15.         local ws = Instance.new("WeldConstraint")
  16.         ws.Part0 = character.LeftLowerLeg
  17.         ws.Part1 = left
  18.         ws.Parent = left
  19.         debris:AddItem(left, 0.3)
  20.         left.Position = character.LeftLowerLeg.Position
  21.         left.Parent = character.LeftLowerLeg
  22.         local right = game.ReplicatedStorage.LegHitbox:Clone()
  23.         ws = Instance.new("WeldConstraint")
  24.         ws.Part0 = character.RightLowerLeg
  25.         ws.Part1 = right
  26.         ws.Parent = right
  27.         debris:AddItem(right, 0.35)
  28.         right.Position = character.RightLowerLeg.Position
  29.         right.Parent = character.RightLowerLeg
  30.         local t = left.Touched
  31.         local tr = right.Touched
  32.         table.insert(events, t)
  33.         table.insert(events, tr)
  34.         for i,v in next, events do
  35.             local hits = {}
  36.             v:Connect(function(hit)
  37.                 if hit:FindFirstAncestorOfClass("Model") and hit:FindFirstAncestorOfClass("Model"):FindFirstChildWhichIsA("Humanoid") then
  38.                     local char = hit:FindFirstAncestorOfClass("Model")
  39.                     if not hits[char] and char:FindFirstChildWhichIsA("Humanoid").Health > 0 then
  40.                        hits[char] = true
  41.                        char:FindFirstChildWhichIsA("Humanoid"):TakeDamage(math.random(50,80))
  42.                     end
  43.                 end
  44.             end)   
  45.         end
  46.         coroutine.resume(coroutine.create(function()
  47.             events[1]:Disconnect()
  48.             events[2]:Disconnect()
  49.         end))          
  50.     end
  51. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement