hello! im trying to get the hitbox system im using working, however the damage remote event is for some reason getting fired twice??
when attacking a dummy, it works as normal, only firing once (see prints from server dmg script)
however! when attacking a player, it fires twice??
as you can see the debounce is still true, however it still fires, and for some reason trying to find the source says its not available, as seen above. the source is only not available for one set of the prints, as the latter shows the correct path and source
slashCaster.HumanoidCollided:Connect(function(result,hitHum)
if canCollide == true then
canCollide = false -- canCollide = true is put somewhere else before the attack
print("collideOff")
slashCaster:Stop()
print("hit" .. slashType.Value)
RemotesFolder.humanoidHit:FireServer(hitHum, slashType.Value)
end
end)
above is the code that fires the event (turning the fireserver into a comment does not fire the server at all, meaning another script firing the same event is not possible)
below is the code that runs when it is fired, its quite big, sorry!
RemotesFolder.humanoidHit.OnServerEvent:Connect(function(player,hitHum,slashType)
if debounce.Value == false then
debounce.Value = true -- debounce.Value = false is again, put somewhere else before the slash
print("debounce " .. tostring(debounce.Value))
print("Dmg" .. slashType)
local isSlash = hitHum:FindFirstChild("slash")
local isBlock = hitHum:FindFirstChild("block")
local isRoll = hitHum:FindFirstChild("roll")
local isParry = hitHum:FindFirstChild("parry")
local hitChar = hitHum.Parent
local hitPlayer = nil
if isParry and isParry.Value == true and hitHum.Health > 0 then
print("Parried!")
RemotesFolder.beenParriedSfx:FireClient(player)
RemotesFolder.beenParried:FireClient(player)
hitHum:TakeDamage(0)
elseif isBlock and isBlock.Value == true and hitHum.Health > 0 then
print("Blocked!")
if slashType == "norm" then
RemotesFolder.beenBlockedSfx:FireClient(player)
hitHum:TakeDamage(100/4)
elseif slashType == "heavy" then
RemotesFolder.bloodSfx:FireClient(player)
hitHum:TakeDamage(50)
if hitPlayer then
print("attempted to send blockBroken!")
RemotesFolder.blockBroken:FireClient(hitPlayer)
end
end
task.wait(0.1)
if hitHum.Health <= 0 then
local leaderstats = player:FindFirstChild("leaderstats")
local Petals = leaderstats:FindFirstChild("Petals")
Petals.Value += 3
gotKill:FireClient(player)
end
elseif isRoll and isRoll.Value == true and hitHum.Health > 0 then
print("Rolled!")
hitHum:TakeDamage(0)
elseif hitHum.Health > 0 then
print("Hit!")
if slashType == "norm" then
RemotesFolder.bloodSfx:FireClient(player)
hitHum:TakeDamage(100)
elseif slashType == "heavy" then
RemotesFolder.bloodSfx:FireClient(player)
hitHum:TakeDamage(150)
end
task.wait(0.1)
if hitHum.Health <= 0 then
local leaderstats = player:FindFirstChild("leaderstats")
local Petals = leaderstats:FindFirstChild("Petals")
Petals.Value += 3
gotKill:FireClient(player)
end
else
print ("Humanoid is Dead.")
end
end
end)
at this point ive tried so many things that im convinced this is some sort of roblox studio bug