I have a Client cast hitbox system and it seems to not detect hits some of the time is there anything I could do to improve the hit detection or change idk if its the animation or the placements of the attachments or something in the script.
Tool Script
local clientCast = require(game.ServerStorage.ClientCast)
local db = false
local debounce = false
local slash
for i = -1.5,2.6,.1 do
local attachment = Instance.new("Attachment",script.Parent.Parts.Base)
attachment.Name = "DmgPoint"
attachment.Position = Vector3.new(i,0,0)
end
local casterParams = RaycastParams.new()
casterParams.FilterDescendantsInstances = {script.Parent.Parent.Parent.Character or script.Parent.Parent.Parent.Parent.Character, script.Parent.Handle}
casterParams.FilterType = Enum.RaycastFilterType.Blacklist
local slashCaster = clientCast.new(script.Parent.Parts.Base, casterParams)
slashCaster.HumanoidCollided:Connect(function(result, hithumanoid)
local Tool = script.Parent
local ToolP = Tool.Parent
local soundOne = Tool.Handle.HitOne
local soundTwo = Tool.Handle.HitTwo
local h = Tool.Parent:FindFirstChild("Humanoid")
local bv = Instance.new("BodyVelocity")
local offset = Vector3.new()
bv.MaxForce = Vector3.new(10000000,10000000,10000000)
bv.Velocity = h.Parent.Head.CFrame.LookVector * 60
bv.Parent = (hithumanoid.Parent.HumanoidRootPart)
wait(0.01)
bv:Destroy()
if hithumanoid.Parent:FindFirstChild("Effects") then
if not hithumanoid.Parent.Effects:FindFirstChild("Ragdoll") then
local z = Instance.new("BoolValue", hithumanoid.Parent.Effects)
z.Name = "Ragdoll"
local Debris = game:GetService("Debris")
Debris:AddItem(z, 2.5)
task.wait(0.1)
if not debounce then
debounce = true
soundOne:Play()
soundTwo:Play()
local Effect = game.ReplicatedStorage.HitBlock:Clone()
Effect.Parent = game.Workspace.HitEffects
Effect.CFrame = ToolP:GetPrimaryPartCFrame() * CFrame.new(0, -1, -4)
Effect.hitFx:Emit(5)
local Debris = game:GetService("Debris")
Debris:AddItem(Effect,0.4)
local KnockOut = Instance.new("ObjectValue")
KnockOut.Name = "KnockOut"
KnockOut.Value = ToolP
KnockOut.Parent = hithumanoid.Parent
Debris:AddItem(KnockOut, 6)
task.wait(0.2)
debounce = false
end
end
end
end)
script.Parent.Equipped:Connect(function()
local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
if not slash then slash = humanoid:LoadAnimation(script.Animation); slash.Priority = Enum.AnimationPriority.Action2 end
end)
script.Parent.Activated:Connect(function()
local Cooldown = script.Parent.Configuration.Cooldown
local ss = script.Parent.Handle.Swing
if not db then
db = true
slash:Play()
ss:Play()
slashCaster:Start()
wait(.5)
slashCaster:Stop()
wait(Cooldown.Value)
db = false
end
end)
script.Parent.Unequipped:Connect(function()
if slash then slash:Stop() end
slashCaster:Stop()
end)
Clip 1
Clip 2
Clip 3