ServerSword Script using RaycastHitBox Module

This code does the slashing damage with no usage of a remote event when the player swing, it gets the keyframe animation event, but I still need more speed. I want someone to help me with getting better speed cause sometimes it’s not working good, this is the server-side script

-- Raycasting Sword for better hitbox
local NewHitBox = RaycastHitbox:Initialize(script.Parent.Blade)

--Raycasting find the enemy between the ray cast 
NewHitBox.OnHit:Connect(function(hit, humanoid)
	if humanoid.Parent == script.Parent.Parent then return end
	hit.Parent.Humanoid:TakeDamage(script.Parent.Configuration.DamageDeal.Value)
end)

local function slash(animationTrack)
	animationTrack:GetMarkerReachedSignal("Windup"):Connect(function()
		NewHitBox:HitStart()
	end)
	animationTrack:GetMarkerReachedSignal("Recover"):Connect(function()
		NewHitBox:HitStop()
	end)
end


local debounce
script.Parent.AncestryChanged:Connect(function(child,parent)
	if debounce then return end
	debounce = true
	local char
	if parent:IsDescendantOf(game.Workspace) then
		for i,v in pairs(game.Players:GetPlayers()) do
			if v and v.Character and v.Character.Humanoid.Health > 0 then
				if parent == v.Character then
					char = v.Character
					break
				end
			end
		end
	else
		char = nil
	end	
	local connection
	if char then
		local animationPlayedDebounce
		connection = char.Humanoid.AnimationPlayed:Connect(function(animationTrack)
			if animationTrack.Animation.AnimationId == script.Parent.Slash1.AnimationId then
				print(animationTrack)
				slash(animationTrack)
						
			end
		end)
		--Equipped Code here
		--print("Equipped")

	else
		if connection then
			connection:Disconnect()
		end
		--Unequipped Code here
		--print("Unequipped")
	end
	debounce = false
end)

You are allowed to use the code if you think it’s good

In Action