the script works perfect but I would like the opponent (player that gets hit) to ragdoll momentarily preferably 1.5 seconds
local rp = game:GetService("ReplicatedStorage")
local combatevent = script.Parent
local animation = script:WaitForChild("Animations")
local acutalplayer = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local tweenService = game:GetService("TweenService")
local ALIVE_TAG_NAME = "Punch"
local Damage = 10
local anims = {
animation:WaitForChild("1"), --Add more animations here
animation:WaitForChild("2"),
animation:WaitForChild("3"),
animation:WaitForChild("4")
}
combatevent.OnServerEvent:Connect(function(player,count,V1)
print("Recieved event")
local character = player.Character
local Hum = character:WaitForChild("Humanoid")
spawn(function()
Hum.WalkSpeed = 8
wait(1.5) -- THIS
Hum.WalkSpeed = 16
end)
local clash = Instance.new("BoolValue")
clash.Name = "ClashAttack"
clash.Value = false
clash.Parent = player.Character
game.Debris:AddItem(clash,0.4)
local dodge = {5491816196,5491829124,5491834231} --paste animation id here
local num = math.random(#dodge)
local chosenanim = dodge[num]
local attack = Hum:LoadAnimation(anims[count])
attack:Play()
combatevent:FireClient(player)
local hiteffectball = function(target,pos)
local hiteffect = game.ReplicatedStorage.Combat.Thing:Clone()
hiteffect.CFrame = pos
hiteffect.CFrame = CFrame.new(hiteffect.Position, target.Position)
hiteffect.Parent = target
game.Debris:AddItem(hiteffect,1)
if count == 4 then
hiteffect.BrickColor = BrickColor.new("Pastel blue-green")
end
tweenService:Create(hiteffect,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{CFrame = hiteffect.CFrame + hiteffect.CFrame.lookVector * -7,Transparency = 1,Size = Vector3.new(0.087, 0.08, 3.35)}):Play()
end
local region = Region3.new(V1-Vector3.new(2,2,2),V1+Vector3.new(2,2,2))
local RTable = workspace:FindPartsInRegion3(region,nil,20)
for i,v in pairs(RTable) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent:FindFirstChild("Deb") == nil and v.Parent ~= character then
local deb = Instance.new("BoolValue",v.Parent)
deb.Name = "Deb"
game.Debris:AddItem(deb,0.2)
local closecharacter = v.Parent
if closecharacter.HumanoidRootPart:FindFirstChild("Block") then
if (closecharacter.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude < 3.5 then
local hiteffect = game.ReplicatedStorage.Combat:WaitForChild("HitCollision"):Clone()
hiteffect.CFrame = closecharacter.HumanoidRootPart.CFrame
hiteffect.Parent = workspace
game.Debris:AddItem(hiteffect,0.6)
local info3 = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local goal3 = {}
goal3.Size = hiteffect.Size * 12
goal3.Transparency = 1
local tween3 = tweenService:Create(hiteffect,info3,goal3)
tween3:Play()
print("played3")
-- hes blocking
if count == 4 then
closecharacter.Blocking.Value = closecharacter.Blocking.Value == false
print("block broken")
local bv = Instance.new("BodyVelocity",closecharacter.HumanoidRootPart)
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = character.HumanoidRootPart.CFrame.lookVector*20
game.Debris:AddItem(bv,0.3)
print("knock him back")
end
else
-- your behind him
if (closecharacter.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Magnitude < 7 then
print("hitting from behind")
closecharacter.Humanoid:TakeDamage(Damage)
script.Hit:Play()
local hitvalue = Instance.new("BoolValue")
hitvalue.Name = "Hit"
hitvalue.Parent = closecharacter
game.Debris:AddItem(hitvalue,1)
local times = 0
repeat
times = times + 1
hiteffectball(closecharacter.HumanoidRootPart,closecharacter.HumanoidRootPart.CFrame * CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)))
until times >= 4
local GoreFX = game.ReplicatedStorage.Combat.Gore:Clone()
local SlashFX = game.ReplicatedStorage.Combat.Gore:Clone()
GoreFX.Parent = closecharacter.HumanoidRootPart
GoreFX:Emit(1)
game.Debris:AddItem(GoreFX,1)
SlashFX.Parent = closecharacter.HumanoidRootPart
SlashFX:Emit(1)
game.Debris:AddItem(SlashFX,1)
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://3932506183"
Sound.Parent = closecharacter.HumanoidRootPart
Sound.PlaybackSpeed = math.random(93,107)/100
Sound:Play()
game.Debris:AddItem(Sound,0.5)
if count == 4 then
local Track11= Instance.new("Animation")
Track11.AnimationId = "rbxassetid://5402391192"
local Anim11 = closecharacter.Humanoid:LoadAnimation(Track11)
Anim11:Play()
local bv = Instance.new("BodyVelocity",closecharacter.HumanoidRootPart)
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = character.HumanoidRootPart.CFrame.lookVector*30
game.Debris:AddItem(bv,0.3)
Anim11:Stop()
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://541909913"
Sound.Parent = closecharacter.HumanoidRootPart
Sound.PlaybackSpeed = math.random(93,107)/100
Sound:Play()
script.Hit:Play()
game.Debris:AddItem(Sound,2)
end
spawn(function()
closecharacter.Humanoid.WalkSpeed = 1
closecharacter.Humanoid.JumpPower = 1
wait(1) --1.7 -- ON TOP WAS 3
closecharacter.Humanoid.WalkSpeed = 16
closecharacter.Humanoid.JumpPower = 50
end)
end
end
else
-- not blocking at all
closecharacter.Humanoid:TakeDamage(Damage)
script.Hit:Play()
print("IF THIS PRINTS")
local times = 0
repeat
times = times + 1
hiteffectball(closecharacter.HumanoidRootPart,closecharacter.HumanoidRootPart.CFrame * CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)))
until times >= 4
local closeplayer = game.Players:GetPlayerFromCharacter(closecharacter)
local hitvalue = Instance.new("BoolValue")
hitvalue.Name = "Hit"
hitvalue.Parent = closecharacter
game.Debris:AddItem(hitvalue,1)
local GoreFX = game.ReplicatedStorage.Combat.Gore:Clone()
GoreFX.Parent = closecharacter.HumanoidRootPart
GoreFX:Emit(1)
game.Debris:AddItem(GoreFX,1)
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://3932506183"
Sound.Parent = closecharacter.HumanoidRootPart
Sound.PlaybackSpeed = math.random(93,107)/100
Sound:Play()
game.Debris:AddItem(Sound,0.5)
if count == 4 then
local Track11= Instance.new("Animation")
Track11.AnimationId = "rbxassetid://5402391192"
local Anim11 = closecharacter.Humanoid:LoadAnimation(Track11)
Anim11:Play()
local bv = Instance.new("BodyVelocity",closecharacter.HumanoidRootPart)
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = character.HumanoidRootPart.CFrame.lookVector*30
game.Debris:AddItem(bv,0.3)
Anim11:Stop()
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://4810749120"
sound.Parent = closecharacter.HumanoidRootPart
sound.PlaybackSpeed = math.random(93,107)/100
sound:Play()
game.Debris:AddItem(sound,3)
end
spawn(function()
closecharacter.Humanoid.WalkSpeed = 1
closecharacter.Humanoid.JumpPower = 1
wait(1) -- 1.7
closecharacter.Humanoid.WalkSpeed = 16
closecharacter.Humanoid.JumpPower = 50
end)
end
end
end
end)