Raycast firing issue

  1. What do you want to achieve? Keep it simple and clear!
    Fix or prevent this abnormal behavior
  2. What is the issue? Include screenshots / videos if possible!

Currently im using RaycastHitboxV4 and upon contact with a enemy I’m Running a Hit animation and for some odd apparent reason its also raycasting during the hitted player Hit animation.

https://gyazo.com/c041a1903639f95538e30cdd55105415

Additional outlook for context

Hitbox.OnHit:Connect(function(hit, humanoid)
	local EnemyCharAttackAttribute = humanoid:FindFirstChild("Attacking")
	local EnemyCharStunnedAttribute = humanoid:FindFirstChild("Stunned")
	local EnemyCharBlockingAttribute = humanoid:FindFirstChild("Blocking")
	local EnemyCharEquippedAttribute = humanoid:FindFirstChild("Equipped")
	local EnemyCharParryAttribute = humanoid:FindFirstChild("Parry")
	local EnemyCharRunAttribute = humanoid:FindFirstChild("Running")

	if humanoid.Parent ~= script.Parent.Parent then
		if EnemyCharEquippedAttribute and EnemyCharBlockingAttribute.Value == false and EnemyCharParryAttribute.Value == false then
			local function EnableParticle()
				HitPlrSoundModule.FireHittedPlrSound(humanoid)
				-- Create an attachment at the hit position
				local Attachment = Instance.new("Attachment")
				Attachment.Parent = hit.Parent.HumanoidRootPart

				-- Emit the particle from the attachment
				local bloodEffectClone = BloodHitEffect:Clone()
				bloodEffectClone.Parent = Attachment
				bloodEffectClone:Emit(10)
				
				HitPlrAnimsModule.PlayRandomHitAnim(humanoid)
				humanoid:TakeDamage(1.5)
				StunHandler.Stun(humanoid, 0.75)
				local hitEffectAttachment = game.ReplicatedStorage.VfxFolder.HitVfx.HitEffectAttachment:GetDescendants()
				local CombathitEffect = hitEffectAttachment:Clone()
				CombathitEffect.Parent = Attachment
				CombathitEffect:Emit(1)

				

				wait(0.15)
				CombathitEffect:Destroy()
				bloodEffectClone:Remove()
				Attachment:Remove()
				
			end
			EnableParticle(hit)
			
		end
	end
end)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    So far i haven’t found anyone who has reproduced this issue. Yes, I have looked for solutions.

Can you show the part of script where you activate the hitbox before running the hit remote? might be an issue in that

Apologies for the late reply just getting back, When the tool is activated i have the hitbox running until the track lengths Completed

raycastRemote.OnServerEvent:Connect(function(player, TrackLength)
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:WaitForChild("Humanoid")
	local AttackAttribute = humanoid:FindFirstChild("Attacking")
	local EquippedAttribute = humanoid:FindFirstChild("Equipped")
	local BlockAttribute = humanoid:FindFirstChild("Blocking")
	
	print(TrackLength)
	Hitbox:HitStart()
	wait(TrackLength)
	Hitbox:HitStop()
end)

Here is also a function in my local script that fires when activated

local function comboCheck()
	if Combo == 0 or Combo > #KatanaSequnce then
		return
	end
	
	local animation = KatanaSequnce[Combo]

	if not animation then
		warn("Invalid animation for Combo: " .. Combo)
		return
	end

	local KatanaTrack = humanoid:LoadAnimation(animation)


	if not KatanaTrack then
		warn("Failed to load animation for Combo: " .. Combo)
		return
	end

	AttackAttribute.Value = true
	KatanaTrack:Play()
	KatanaTrail.Enabled = true
	raycastRemote:FireServer(KatanaTrack.Length) -- Cast Hitbox
	SwordSoundModule.PlaySwordSound(humanoid.Parent.HumanoidRootPart)
	
	
	wait(KatanaTrack.Length)
	wait(gWait)

	AttackAttribute.Value = false
	KatanaTrail.Enabled = false
	print(Combo)

	if Combo == #KatanaSequnce then
		wait(fWait)
		Combo = 0
	end
end 

Your issue is likely caused from the hitbox script registering for every sword hitbox. I am not too sure how the raycast hitbox script you’re using works, but it may be caused in the server script. I see that you use Hitbox:HitStart() in the server when a player fires the event, but there is no localization defining it so only that player activates their hitbox. In other words, how do you know you are starting the hit for only that player and not others?