So i have a sword that works but has the hitbox broken. Whenever a player is attacked the damage does not confirm unless the player was hit at a certain angle
(sorry about the watermark i had to compress the file)
I tried turning on collision on the handle but that didnt work either
This is the script i have in the tool
Tool:WaitForChild("Handle").Touched:Connect(function(OtherPart)
if IsAttack == true and CoolDown == false then
print(OtherPart)
local OtherHum = OtherPart.Parent:FindFirstChild("Humanoid")
local PartHit = OtherPart
local Torso = OtherPart.Parent:FindFirstChild("Torso")
Sound.SoundId = "rbxassetid://2752894534"
Sound.TimePosition = 0.24
Sound:Play()
OtherHum.Health = OtherHum.Health - 20
end
end)
Is there anything i can do to fix the hitbox?
I suggest using Raycasts for sword hitboxes. Or just use this module, which uses raycasts: Raycast Hitbox 4.01: For all your melee needs! - #93 by ZilverLazarus
i think that if you create a new part while the animation plays it will detect better
Is your handle’s CanCollide set to false? If not, set it to false. Also, in your script there seems to be an issue with damage being taken at either 100 or 20 so you could define a variable and use it to confirm if the action is still happening.
local Debounce = false
Tool.Handle.Touched:Connect(function(OtherPart)
if IsAttack == true and CoolDown == false then
if not Debounce then
Debounce = true
print(OtherPart)
local OtherHum = OtherPart.Parent:FindFirstChild("Humanoid")
local PartHit = OtherPart
local Torso = OtherPart.Parent:FindFirstChild("Torso")
Sound.SoundId = "rbxassetid://2752894534"
Sound.TimePosition = 0.24
Sound:Play()
OtherHum.Health = OtherHum.Health - 20
Debounce = false
end
end
)