Hello, my my detectTouch() function runs but the for loop with the Hitbox’s GetTouchingParts() method isn’t running. Here’s the code I’m using (example, Check 1 is printed but Check 2 isn’t.):
local function detectTouch()
print("Check 1")
for _, part in pairs(Hitbox:GetTouchingParts()) do
print("Check 2")
if part:IsA("BasePart") and part.Parent:IsA("Model") then
local Enemy = part.Parent
local EHumanoid = Enemy:FindFirstChildOfClass("Humanoid")
local EHumRP = Enemy:FindFirstChild("HumanoidRootPart")
if Enemy ~= Character and EHumanoid and EHumRP and EHumanoid.Health ~= 0 then
Hitbox:Destroy()
break
end
end
end
end
while Hitbox.Parent do
task.wait()
detectTouch()
end