Ok so I have this script with combo parts combo 1 - 5 I would like to know if there is a way I can make where when you get hit you play an animation and
The script has 1 main and 3 sub also one is local
This is the main
script https://www.youtube.com/watch?v=MPHMDBa1EwE
local Cooldown = false
local CanDamage = false
local Combo = 1
local Delay = .65
game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(Player)
if Cooldown then return end
for _, v in pairs(Player.Character:GetChildren()) do
if v:IsA(âToolâ) then return end
end
spawn(function()
Cooldown = true
wait(Delay)
Cooldown = false
end)
local Swoosh = Instance.new(âSoundâ,Player.Character.HumanoidRootPart)
Swoosh.SoundId = ârbxassetid://231731980â
Swoosh.Volume = .2
Swoosh.EmitterSize = 100
local rightPunch = Instance.new(âAnimationâ)
rightPunch.AnimationId = ârbxassetid://5346044818â
local rightTrack = Player.Character.Humanoid:LoadAnimation(rightPunch)
local leftPunch = Instance.new(âAnimationâ)
leftPunch.AnimationId = ârbxassetid://5345920226â
local leftTrack = Player.Character.Humanoid:LoadAnimation(leftPunch)
local Finisher = Instance.new(âAnimationâ)
Finisher.AnimationId = ârbxassetid://5350338921â
local finalKick = Player.Character.Humanoid:LoadAnimation(Finisher)
if Combo == 1 then
rightTrack:Play()
Swoosh:Play()
local Dmg = script.RightArm:Clone()
Dmg.Parent = Player.Character[âRight Armâ]
Dmg.Disabled = false
wait(Delay)
Dmg.Disabled = true
Dmg:Destroy()
Combo = 2
else if Combo == 2 then
leftTrack:Play()
Swoosh:Play()
local Dmg = script.LeftArm:Clone()
Dmg.Parent = Player.Character[âLeft Armâ]
Dmg.Disabled = false
wait(Delay)
Dmg.Disabled = true
Dmg:Destroy()
Combo = 3
else if Combo == 3 then
rightTrack:Play()
Swoosh:Play()
local Dmg = script.RightArm:Clone()
Dmg.Parent = Player.Character[âRight Armâ]
Dmg.Disabled = false
wait(Delay)
Dmg.Disabled = true
Dmg:Destroy()
Combo = 4
else if Combo == 4 then
leftTrack:Play()
Swoosh:Play()
local Dmg = script.LeftArm:Clone()
Dmg.Parent = Player.Character[âLeft Armâ]
Dmg.Disabled = false
wait(Delay)
Dmg.Disabled = true
Dmg:Destroy()
Combo = 5
else if Combo == 5 then
finalKick:Play()
Swoosh:Play()
local Dmg = script.Finisher:Clone()
Dmg.Parent = Player.Character[âRight Legâ]
Dmg.Disabled = false
wait(Delay)
Dmg.Disabled = true
Dmg:Destroy()
Combo = 1
end
end
end
end
end
end)