This might be a problem with my code or with the way I handle my tool animation, but for some reason, the Hitbox points are being offset by quite a bit.
Here is my code for setting up the hitbox:
function Weapon:SetUpHitbox()
local HitboxParams = RaycastParams.new()
HitboxParams.FilterDescendantsInstances = {self.Character}
HitboxParams.FilterType = Enum.RaycastFilterType.Blacklist
local Hitbox = RaycastHitbox.new(self.Tool.Handle)
Hitbox.RaycastParams = HitboxParams
Hitbox:SetPoints(self.Tool.Handle, {Vector3.new(0, 0, 1), Vector3.new(0, 0, 2), Vector3.new(0, 0, 3)})
return Hitbox
end
Here is my code for the player swinging:
function Weapon:Swing()
if self.SwingDebounce then return end
self.SwingDebounce = true
if self.LastSwing == 3 then
self.LastSwing = 1
self.CurrentSwingAnimation = self.Animations["Swing1"]
else
self.LastSwing += 1
self.CurrentSwingAnimation = self.Animations["Swing"..self.LastSwing]
end
self.Hitbox:HitStart()
table.insert(self.PlayingAnimations, self.CurrentSwingAnimation)
self.CurrentSwingAnimation:Play()
local CurrentAnimationStopped
CurrentAnimationStopped = self.CurrentSwingAnimation.Stopped:Connect(function()
if not self.IsEquipped then return end
table.remove(self.PlayingAnimations, table.find(self.PlayingAnimations, self.CurrentSwingAnimation))
self.Hitbox:HitStop()
self.SwingDebounce = false
CurrentAnimationStopped:Disconnect()
end)
end
I am using this method to animate my tool handle, but it shouldn’t interfere with the hitbox.
Thanks!