I am basically firing multiple rays along the blade to detect if it has hit something. The problem is I am only able to fire 8 rays in 0.3 secs (how long the animation lasts), which creates big spaces between rays where a part can be undetected.
I wanted to know if there’s a better way to detect a hit without using the touched event or a way to fire more rays.
edit: I am using the spawn function to run the detection
function DetectPart() -- Raycast to find Part
while Slashes[Amount].IsPlaying do
wait()
local Start = Sword.Point.CFrame
local NewRay = Ray.new(Start.Position, Start.lookVector * 4.5)
local Part, Position = workspace:FindPartOnRayWithIgnoreList(NewRay, Character:GetDescendants())
if Part and Part.Parent:FindFirstChild("Humanoid") then
Sword.Blade.Hit:Play()
Part.Parent.Humanoid:TakeDamage(5)
break
end
end
end