I need this script to work to make my game. Its a script so when a weapon's projectile touches the brick, it lets the projectile pass, but its not working.
function onTouch(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if (humanoid == nil) then -- if there is no humanoid in the thing that's touching it...
script.Parent.CanCollide = false -- make the brick passable, or go-through (not working)
wait(3) --wait 3 seconds
script.Parent.CanCollide = true -- make the brick into a full brick again (not working)
elseif -- or if
(humanoid ~= nil) then -- a humanoid exists, then
humanoid.Health = 0 -- kill the player (now working thanks to... aews5 and Hybric)
end
end
script.Parent.Touched:connect(onTouch)
Its supposed to do what the quotes say but its not working.

1 comment
it kills the player now, but the projectiles aren't going through the brick.