Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.01 KB | None | 0 0
  1. local Event = script.Parent:WaitForChild("Communicate")
  2.  
  3. local PunchDebounce = false
  4.  
  5. function Right(Player)
  6.     local RightHand = Player.Character:FindFirstChild("RightHand")
  7.     local RightUpperArm = Player.Character:FindFirstChild("RightUpperArm")
  8.     local RightLowerArm = Player.Character:FindFirstChild("RightLowerArm")
  9.     if RightHand and RightLowerArm and RightUpperArm then
  10.         local Damage = false
  11.         local Listener1 = RightHand.Touched:Connect(function(Hit)
  12.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  13.                 Damage = true
  14.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  15.                 print("right lower")
  16.             end
  17.         end)
  18.         local Listener2 = RightUpperArm.Touched:Connect(function(Hit)
  19.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  20.                 Damage = true
  21.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  22.                 print("right upper")
  23.             end
  24.         end)
  25.         local Listener3 = RightLowerArm.Touched:Connect(function(Hit)
  26.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  27.                 Damage = true
  28.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  29.                 print("right lower")
  30.             end
  31.         end)
  32.         wait(.3)
  33.         Listener1:Disconnect()
  34.         Listener2:Disconnect()
  35.         Listener3:Disconnect()
  36.         PunchDebounce = false
  37.     else
  38.         PunchDebounce = false
  39.     end
  40. end
  41.  
  42. function Left(Player)
  43.     local LeftHand = Player.Character:FindFirstChild("LeftHand")
  44.     local LeftUpperArm = Player.Character:FindFirstChild("LeftUpperArm")
  45.     local LeftLowerArm = Player.Character:FindFirstChild("LeftLowerArm")
  46.     if LeftHand and LeftLowerArm and LeftUpperArm then
  47.         local Damage = false
  48.         local Listener1 = LeftHand.Touched:Connect(function(Hit)
  49.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  50.                 Damage = true
  51.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  52.                 print("left hand")
  53.             end
  54.         end)
  55.         local Listener2 = LeftUpperArm.Touched:Connect(function(Hit)
  56.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  57.                 Damage = true
  58.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  59.                 print("left upper")
  60.             end
  61.         end)
  62.         local Listener3 = LeftLowerArm.Touched:Connect(function(Hit)
  63.             if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
  64.                 Damage = true
  65.                 Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
  66.                 print("left lower")
  67.             end
  68.         end)
  69.         wait(.3)
  70.         Listener1:Disconnect()
  71.         Listener2:Disconnect()
  72.         Listener3:Disconnect()
  73.         PunchDebounce = false
  74.     else
  75.         PunchDebounce = false
  76.     end
  77. end
  78.  
  79. Event.OnServerEvent:Connect(function(Player, RightPunch)
  80.     if Player.Character == script.Parent.Parent then
  81.         if not PunchDebounce then
  82.             PunchDebounce = true
  83.             if RightPunch == true then
  84.                 Right(Player)
  85.             elseif RightPunch == false then
  86.                 Left(Player)
  87.             end
  88.         end
  89.     end
  90. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement