How can I get better hit registration on these swords?

There was a project I posted about a while ago here - in which I was having an issue with hit registration. The blocks were simply moving too fast for :GetTouchingParts to be viable. After somebody had suggested using Raycasting Hitbox module I thought all my issues were solved.

Yet - it doesn’t entirely help. The hit registration is still lackluster - causing you to miss incoming notes that you personally know were hit. (You see the saber cross straight through them)

Do you have any ideas of a better way to do these notes? For reference - here is how I move the notes and how I move the sabers.

Note moving:

local goal = {}
goal.Position = Vector3.new(newCube.Position.X,newCube.Position.Y,50)
local tween = TS:Create(newCube,TI,goal)
tween:Play()

Sword moving:

VRS.UserCFrameChanged:Connect(function(limb, position)
	if limb == Enum.UserCFrame.RightHand then
		workspace.rightSaber.handle.CFrame = CAM.CFrame*CFrame.new(position.p*CAM.HeadScale) * (position - position.p) 
	elseif limb == Enum.UserCFrame.LeftHand then
		workspace.leftSaber.handle.CFrame = CAM.CFrame*CFrame.new(position.p*CAM.HeadScale) * (position - position.p) 
	end
end)

Current raycast implementation (I’ve an identical function for the right hand)

local rayHit = require(script.RaycastHitbox)
local hitBoxL = rayHit:Initialize(workspace.leftSaber,{workspace.leftSaber,workspace.rightSaber})
hitBoxL.OnHit:Connect(function(hitTable)
    for _,hit in next, hitTable do
        if hit.Name == "cube" and hit:FindFirstChild('hand') then
			if hit.hand.Value == 2 then
				workspace.sound_service.hit:Play()
				workspace.base.SurfaceGui.Frame.TextLabel.Text = tonumber(workspace.base.SurfaceGui.Frame.TextLabel.Text) + 1
			else
				workspace.sound_service.wrong:Play()
				workspace.base.SurfaceGui.Frame.TextLabel.Text = 0
			end
			hit:Destroy()
		end
    end
end)
1 Like