local fist = script.Parent
local combathit = game:GetService("ReplicatedStorage").Combathit
local handle = fist.Handle
local parrysound = fist.ParrySound
local RaycastHitbox = require(game.ServerScriptService.RaycastHitboxV4)
local hitbox1 = RaycastHitbox.new(fist.Hitbox)
local fistsound = fist.punchsound
local parry = game:GetService("ReplicatedStorage").Parry
config = {
atktime = 1.3,
damage = 5,
parrytime = .7
}
local function onParry(player, blockheldtime)
hitbox1.OnHit:Connect(function(hit, humanoid)
local currenttime = os.time()
local parryduration = currenttime - blockheldtime
print(parryduration)
if humanoid.Parent ~= script.Parent.Parent then
if parryduration <= config.parrytime then
print("yes")
local parryvfx = game.ReplicatedStorage["ParryEffect"].Attachment:Clone()
parryvfx.Parent = humanoid.Parent:FindFirstChild("HumanoidRootPart")
parrysound:Play()
for i,v in pairs(parryvfx:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(parryvfx, 1.19)
elseif parryduration >= config.parrytime then
humanoid:TakeDamage(config.damage)
fistsound:Play()
local hitvfx = game.ReplicatedStorage["Hiteffect"].Attachment:Clone()
hitvfx.Parent = humanoid.Parent:FindFirstChild("HumanoidRootPart")
for i,v in pairs(hitvfx:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local npcred = game.ReplicatedStorage["npchighlight"]:Clone()
npcred.Parent = humanoid.Parent
game.Debris:AddItem(npcred,.24)
game.Debris:AddItem(hitvfx,1)
end
print(blockheldtime)
end
end)
end
parry.OnServerEvent:Connect(onParry)
combathit.OnServerEvent:Connect(function()
hitbox1:HitStart()
task.wait(config.atktime)
hitbox1:HitStop()
end)
parrysystem not working it doesnt damage a dummy unless i the attacker parry without even being hit by anything. Not sure why parry is not working only been scripting for a month bear with me
blockheldtime is the amount of time a player held block for, its passed through client to server.