This script should:
Start with all Parts (1-9) with Transparency 1
Turn each part to Transparency 0, with a 1 second delay after each one
onTouch by a humanoid, if Transparency is 0, then it kills humanoid
I want them all to disappear at the same time
Here is what I have so far (Not Working) I have a model, inside the model is the script along with all the parts.
I know probably the "while true do" is in the wrong spot, along with the "end"s and "else"s. Need help figuring out where to put those.
while true do
script.Parent.Part1.Transparency = 1
wait(1)
script.Parent.Part1.Transparency = 0
function onTouch(part)
if script.Parent.Part1.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part2.Transparency = 1
wait(1)
script.Parent.Part2.Transparency = 0
if script.Parent.Part2.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part3.Transparency = 1
wait(1)
script.Parent.Part3.Transparency = 0
if script.Parent.Part3.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part4.Transparency = 1
wait(1)
script.Parent.Part4.Transparency = 0
if script.Parent.Part4.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part5.Transparency = 1
wait(1)
script.Parent.Part5.Transparency = 0
if script.Parent.Part5.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part6.Transparency = 1
wait(1)
script.Parent.Part6.Transparency = 0
if script.Parent.Part6.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part7.Transparency = 1
wait(1)
script.Parent.Part7.Transparency = 0
if script.Parent.Part7.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part8.Transparency = 1
wait(1)
script.Parent.Part8.Transparency = 0
if script.Parent.Part8.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
script.Parent.Part9.Transparency = 1
wait(1)
script.Parent.Part9.Transparency = 0
if script.Parent.Part9.Transparency == 0 then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid ~= nil then
humanoid.Health = 0
end
else
wait()
end
end
script.Parent.Touched:Connect(onTouch)
wait(3)
end

2 comments
Thank you for the good answer & explanation! I can use this for something else i'm making, but for this question it doesn't satisfy point #4 above. How would I edit it to have them disappear at once? Opposed to disappearing one at a time.
Using "for i =1,9,1 do" without a wait() time will simply go through the list but at the same time. Like in the first chunk of code, each of the 9 parts there gain that function at the same time because that chunk doesn't have a wait time.