Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Event = script.Parent:WaitForChild("Communicate")
- local PunchDebounce = false
- function Right(Player)
- local RightHand = Player.Character:FindFirstChild("RightHand")
- local RightUpperArm = Player.Character:FindFirstChild("RightUpperArm")
- local RightLowerArm = Player.Character:FindFirstChild("RightLowerArm")
- if RightHand and RightLowerArm and RightUpperArm then
- local Damage = false
- local Listener1 = RightHand.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("right lower")
- end
- end)
- local Listener2 = RightUpperArm.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("right upper")
- end
- end)
- local Listener3 = RightLowerArm.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("right lower")
- end
- end)
- wait(.3)
- Listener1:Disconnect()
- Listener2:Disconnect()
- Listener3:Disconnect()
- PunchDebounce = false
- else
- PunchDebounce = false
- end
- end
- function Left(Player)
- local LeftHand = Player.Character:FindFirstChild("LeftHand")
- local LeftUpperArm = Player.Character:FindFirstChild("LeftUpperArm")
- local LeftLowerArm = Player.Character:FindFirstChild("LeftLowerArm")
- if LeftHand and LeftLowerArm and LeftUpperArm then
- local Damage = false
- local Listener1 = LeftHand.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("left hand")
- end
- end)
- local Listener2 = LeftUpperArm.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("left upper")
- end
- end)
- local Listener3 = LeftLowerArm.Touched:Connect(function(Hit)
- if Hit.Parent and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Player.Character and not Damage then
- Damage = true
- Hit.Parent.Humanoid:TakeDamage(math.random(1,10))
- print("left lower")
- end
- end)
- wait(.3)
- Listener1:Disconnect()
- Listener2:Disconnect()
- Listener3:Disconnect()
- PunchDebounce = false
- else
- PunchDebounce = false
- end
- end
- Event.OnServerEvent:Connect(function(Player, RightPunch)
- if Player.Character == script.Parent.Parent then
- if not PunchDebounce then
- PunchDebounce = true
- if RightPunch == true then
- Right(Player)
- elseif RightPunch == false then
- Left(Player)
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement