Hey guys!
So, I’ve been working on my first Hand to Hand Combat system for a few days now, and I got a pretty good system down. I have a small issue though.
Everytime I activate the combat (uses UIS to activate), and I hit, the animation plays really fast and is seemingly buggy. Everytime I block however, and then hit, it works perfect. This is the main hit code, I don’t want to send all the code as its like 250 lines for the server side and too much to send alone.
HitEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character
local hum = char.Humanoid
if blocked.Value == true then warn("Blocking Currently") return end
local partsNearby = createRay(char)
if partsNearby == nil and damageDebounce == false then
print("nun")
damageDebounce = true
playCombo(hum)
wait(DebounceTime.Value)
damageDebounce = false
return
end
if partsNearby == nil or damageDebounce == true then return end
if partsNearby.Parent:FindFirstChild("Humanoid") then
print('sum')
damageDebounce = true
playCombo(hum)
local EnemyChar = partsNearby.Parent
local EnemyHum = EnemyChar:FindFirstChild("Humanoid")
local damage = findDamage(EnemyChar,char)
EnemyHum:TakeDamage(damage,EnemyChar)
if damage <= 0 then
playAnim(ParriedAnim,hum)
parried.Value = true
local newParry = createEffect(Vector3.new(char.Head.Position.X,char.Head.Position.Y*1.5,char.Head.Position.Z),EnemyChar,ParryEffect)
hum.WalkSpeed = 0
hum.JumpHeight = 0
playSound(EnemyChar.HumanoidRootPart.Position,EnemyChar,ParrySound)
wait(ParryTime.Value)
stopAnim(hum)
parried.Value = false
tweenEffect(newParry)
hum.WalkSpeed = game:GetService("StarterPlayer").CharacterWalkSpeed
hum.JumpHeight = game:GetService("StarterPlayer").CharacterJumpHeight
damageDebounce = false
else
local newBlood = createEffect(EnemyChar.HumanoidRootPart.Position,EnemyChar,HitEffect)
playSound(EnemyChar.HumanoidRootPart.Position,EnemyChar,HitSound)
wait(DebounceTime.Value)
damageDebounce = false
tweenEffect(newBlood)
end
end
end)
Please if you know whats up with animations let me know!