#overlapparams doesnt work

1 messages · Page 1 of 1 (latest)

radiant tartan
#

local animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

local attackanim = script:WaitForChild("attackanim")
local attackanimTrack = animator:LoadAnimation(attackanim)

local range = script.Parent:WaitForChild("range")
local vfx = script.Parent:WaitForChild("vfx"):WaitForChild("vfxparry")

local player = game:GetService("Players")
local mobs = game.Workspace:WaitForChild("currentmob"):GetChildren()

local playerhitted = {}

range.Touched:Connect(function(somethingtouchedrange)
if somethingtouchedrange.Parent:FindFirstChild("Humanoid") and player:GetPlayerFromCharacter(somethingtouchedrange.Parent) then

    if somethingtouchedrange.Parent:FindFirstChild("Humanoid").Health > 0 and not table.find(playerhitted, somethingtouchedrange.Parent) then
        table.insert(playerhitted, somethingtouchedrange.Parent)
        attackanimTrack:Play()
        attackanimTrack.Priority = Enum.AnimationPriority.Movement
        
        task.wait(10)
        table.clear(playerhitted, somethingtouchedrange.Parent)
    end
end

end)

attackanimTrack:GetMarkerReachedSignal("vfxparrystart"):Connect(function(vfxparryhasstarted)
if vfxparryhasstarted then
print("vfxparry started")
vfx:Emit(1)
end
end)

#

^this script is the first half ill post the full one down here just ignore it

#

--why clyd said my message could not be deliverred

#

what is happening why clyde is deleting all my messages

#

local animator = script.Parent:WaitForChild("Humanoid"):WaitForChild("Animator")

local attackanim = script:WaitForChild("attackanim")
local attackanimTrack = animator:LoadAnimation(attackanim)

local range = script.Parent:WaitForChild("range")
local vfx = script.Parent:WaitForChild("vfx"):WaitForChild("vfxparry")

local player = game:GetService("Players")
local mobs = game.Workspace:WaitForChild("currentmob"):GetChildren()

local playerhitted = {}

range.Touched:Connect(function(somethingtouchedrange)
if somethingtouchedrange.Parent:FindFirstChild("Humanoid") and player:GetPlayerFromCharacter(somethingtouchedrange.Parent) then

    if somethingtouchedrange.Parent:FindFirstChild("Humanoid").Health > 0 and not table.find(playerhitted, somethingtouchedrange.Parent) then
        table.insert(playerhitted, somethingtouchedrange.Parent)
        attackanimTrack:Play()
        attackanimTrack.Priority = Enum.AnimationPriority.Movement

        task.wait(10)
        table.clear(playerhitted, somethingtouchedrange.Parent)
    end
end

end)

attackanimTrack:GetMarkerReachedSignal("vfxparrystart"):Connect(function(vfxparryhasstarted)
if vfxparryhasstarted then
print("vfxparry started")
vfx:Emit(1)
end
end)

#

attackanimTrack:GetMarkerReachedSignal("punch1"):Connect(function(punch1hasstarted)
if punch1hasstarted then
print("hitbox script has started")
local zomcframe = script.Parent.HumanoidRootPart.CFrame * CFrame.new(Vector3.new(0, 0, -4))
local hitboxsize = Vector3.new(9, 9, 8)

    local hitbox = Instance.new("Part")
    hitbox.Anchored = true
    hitbox.CanCollide = false
    hitbox.CanQuery = false
    hitbox.CanTouch = false
    hitbox.Size = hitboxsize
    hitbox.CFrame = zomcframe
    hitbox.BrickColor = BrickColor.new("Really red")
    hitbox.Transparency = 0.75
    hitbox.Parent = workspace

    local params = OverlapParams.new()
    params.FilterDescendantsInstances = {hitbox, mobs}
#

local somethingtouchedhitbox = workspace:GetPartBoundsInBox(zomcframe, hitboxsize, params)

    local hitchar = {}
    for i, part in pairs(somethingtouchedhitbox) do
        if part.Parent:FindFirstChildOfClass("Humanoid") and not table.find(hitchar, part.Parent) then
            table.insert(hitchar, part.Parent)
            print(part.Parent.Name)
            part.Parent:WaitForChild("Humanoid").Health -=10


            part.Parent:SetAttribute("stunned", true)
            print("set part parent stun to true")
            task.wait(2)
            part.Parent:SetAttribute("stunned", false)
            print("set part parent stun to false")

            --[[task.spawn(function()
                part.Parent:WaitForChild("Humanoid").WalkSpeed = 4
                task.wait(3)
                part.Parent:WaitForChild("Humanoid").WalkSpeed = 10
            end)]]
        end
    end

    task.delay(0.25, function()
        hitbox:Destroy()
        print("hitbox has been destroyed")
    end)
end

end)

#

i think something is wrong with the "local mobs" script of me calling to get all of the children inside of the currentmob (which is a folder)