I am working on a hitbox script it works and does damage but if the player who creates the hitbox is touching it, it does not do damage to anyone, is there a way I can ignore the local player? It also does damage to only 1 humanoid not all in the hitbox.
Script:
local function createhitbox()
local hitboxdb = false
local hitbox = Instance.new("Part")
hitbox.Parent = workspace
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Size = Vector3.new(10,1,10)
hitbox.Transparency = 0.5
hitbox.CFrame = hrp.CFrame * CFrame.new(0,0,-4)
hitbox.Touched:Connect(function(hit)
if hitboxdb == false then
hitboxdb = true
local enemycharacter = hit.Parent
print(enemycharacter)
local hithumanoid = enemycharacter:FindFirstChild("Humanoid")
if hithumanoid == hum then
else
hithumanoid:TakeDamage(5)
end
task.wait(0.5)
hitboxdb = false
end
end)
wait(0.1)
hitbox:Destroy()
end