local Player = game.Players.LocalPlayer
local character = Player.Character
local humanoid = character.Humanoid
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local PunchedEvent
local mouse = Player:GetMouse()
local CanPunch = true
local PunchCombo = 0
local Target
local function TweenGUI(Gui)
TweenService:Create(Gui.Parent,
TweenInfo.new (0.4), {StudsOffset =
Vector3.new (0, 1, 0)}):Play()
end
local function AddDamageGUI(PunchCombo, Victim, Damage)
local DamageGUI = script.DamageGUI:Clone()
DamageGUI.Damage.Text = Damage
if PunchCombo == 1 then
DamageGUI.Parent = Victim["Left Arm"]
elseif PunchCombo == 2 then
DamageGUI.Parent = Victim["Right Arm"]
elseif PunchCombo == 3 then
DamageGUI.Parent = Victim["Left Leg"]
end
TweenGUI(DamageGUI.Damage)
end
mouse.Button1Down:Connect(function()
if
mouse.Target ~= nil and
mouse.Target .Parent:FindFirstChild("Humanoid") and
mouse.Target .Parent ~= character then
if (
mouse.Target .Parent.PrimaryPart.Position - character.PrimaryPart.Position).magnitude < 4 then
local Victim =
mouse.Target .Parent
if Target ~= Victim then
PunchCombo = 0
end
Target = Victim
local VictimHumanoid = Victim.Humanoid
CanPunch = false
PunchCombo+= 1
local PunchAnimation = humanoid:LoadAnimation(script["Punch"..PunchCombo])
PunchAnimation:Play()
local DamageAnimation = VictimHumanoid:LoadAnimation(script:WaitForChild("Damage"..PunchCombo))
wait(0.366666667)
DamageAnimation:Play()
VictimHumanoid.Health -= 10
AddDamageGUI(PunchCombo, Victim, "-10")
local VelocityMultiplier
if PunchCombo == 3 then
local Velocity =
Instance.new ("BodyVelocity")
Velocity.MaxForce =
Vector3.new (1,0,1) * 29900
Velocity.Velocity = character.HumanoidRootPart.CFrame.lookVector * 10
Velocity.Parent = Victim.HumanoidRootPart
for count = 1, 8 do
wait(0.1)
Velocity.Velocity*= 0.6
end
Velocity:Destroy()
end
PunchAnimation:Stop()
DamageAnimation:Stop()
if PunchCombo == 3 then wait(2) end
CanPunch = true
end
end
end)
repeat wait()
if PunchCombo == 3 then
PunchCombo = 0
end
until nil