For some reason, some of the hits miss. Even though it’s CLEARLY hitting the character.
I think it might be related to the hitbox hitting the other player’s weapon, but I don’t really know how to fix it.
I know filterparams exists. but I don’t know how to filter the other player’s weapon using it.
The hitbox is infront of the weapons:
Here is the script:
local tool = script.Parent.Parent
local handle = tool:WaitForChild("Handle")
local stab = tool:WaitForChild("Stab")
local debris = game:GetService("Debris")
-- Configurations
local config = script.Parent.Parent.Inact:WaitForChild("Configuration")
local kitchenknife = config:WaitForChild("KitchenKnife")
local animid = kitchenknife.Animation
local cd = kitchenknife.Cooldown
local damage = kitchenknife.Damage
local humdeb = false
local params = OverlapParams.new()
params.FilterDescendantsInstances = {
script.Parent.Parent.Parent,
script.Parent.Parent:FindFirstChild("Handle", true),
script.Parent,
script.Parent.Parent.Handle
}
params.MaxParts = 100
tool.Activated:Connect(function()
local char = script.Parent.Parent.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local multiplier = plr.DamageMultiplier
local smultiplier = plr.RateMultiplier
local parts = workspace:GetPartBoundsInBox(script.Parent.CFrame, script.Parent.Size, params)
if parts then
for i,v in pairs(parts) do
if v.Parent:FindFirstChild("Humanoid") and humdeb == false then
local tag = Instance.new("ObjectValue")
tag.Name = "tag"
tag.Value = plr
tag.Parent = v.Parent.Humanoid
debris:AddItem(tag, .5)
print(tag.Name)
humdeb = true
v.Parent:FindFirstChild("Humanoid"):TakeDamage(damage.Value * multiplier.Value)
task.wait(cd.Value * smultiplier.Value)
humdeb = false
break
else
return
end
end
task.wait()
end
end)
(The coins are meant to go up when damage is dealt and I know for a fact there’s no problem with the script for making coins increase)