-
What do you want to achieve?
I want to have multiple (42 to be exact) killBricks with 1 script so it is efficient. -
What is the issue?
My script wont add touch interests to all of the bricks, only a few get the interest. -
What solutions have you tried so far?
I’ve tried searching for someone with a similar problem but couldn’t find any results.
-- there is 42 bricks + 1 script
local bricks
repeat bricks = script.Parent:GetChildren()
task.wait(.25)
until #bricks == 43
for i, v in ipairs(bricks) do
if not v:IsA("Part") then return end
v.Touched:Connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if not hum then return end
hum.Health = 0
end)
end
Result