Hello devs! So I’m using OverlapParameters for my hitboxes, but there’s issue, it damages player too much, like if I want to take 5 health from player, it takes more, I know the issue is the part amout, but I don’t know how to fix it.
Here is my current code :
local attack1 = script.Parent.Parent.Monster.Animator:LoadAnimation(script.Parent.Parent:WaitForChild("Attack1"))
local attack2 = script.Parent.Parent.Monster.Animator:LoadAnimation(script.Parent.Parent:WaitForChild("Attack2"))
local op = OverlapParams.new()
op.FilterDescendantsInstances = {script.Parent.Parent}
op.FilterType = Enum.RaycastFilterType.Blacklist
coroutine.wrap(function()
while task.wait(script.Parent.Parent.Configuration.DamageDebounce.Value) do
local op = OverlapParams.new()
op.FilterDescendantsInstances = {script.Parent.Parent}
op.FilterType = Enum.RaycastFilterType.Blacklist
local parts = workspace:GetPartsInPart(script.Parent,op)
if parts then
for _,hit in pairs(parts) do
if hit.Parent and hit.Parent ~= script.Parent.Parent and hit.Parent:FindFirstChildWhichIsA("Humanoid") then
local hum = hit.Parent:FindFirstChildWhichIsA("Humanoid")
local random = math.random(1,2)
if random == 1 then
attack1:Play()
elseif random == 2 then
attack2:Play()
end
hum:TakeDamage(script.Parent.Parent.Configuration.Damage.Value)
end
end
end
end
end)()
(This script can be placed in any part, just chance some stuff.)
PS : There may be grammar mistakes in this topic.