First of all, I have no idea what I was doing after the first couple of lines. I was trying to figure out how to make a lot of bricks at one time earlier and It got answered, but then I thought, how about make them kill you as well. Well... I successfully failed. I got them to spawn a lot but I wanted each and every one of them kill you if you touched them. So I tried and here it went
while true do
wait(0.3)
Part = Instance.new("Part", workspace)
Part.Position = Vector3.new(workspace.Spawner)
function KillBrick()
local h = Instance.new("Part", workspace)
if h.Parent:FindFirstChild("Humanoid") then
if h.Parent~= 0 then
h.Parent.Humanoid.Health = 0
end
end
end
script.Parent.Touched:connect(KillBrick)
Part.BrickColor = BrickColor.new("Really Red")
wait(0.1)
end
Also, I wanted to know how would I edit that brick everytime it spawns. For example, I was trying to figure out how to make the brick red or yellow or something....

1 comment
Erm. Have the damage code in another script. When the part is made, clone the script into the part.