Advertisement
Guest User

Server v2

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