Okay, so I was trying to make a script that will make a flood happen and when you die you spawn somewhere else. However, it will not work. Could someone help me?
local flood_control = script.Parent:WaitForChild("flood_controller")
local flood = script.Parent
local spawnP = game.Workspace:WaitForChild("MainPlate").SpawnLocation
local sound = script.Parent:WaitForChild("Part"):WaitForChild("Intense Music 4")
while wait(.5) do
if flood.Parent == workspace then
flood_control.Disabled = false
spawnP.Enabled = false
else
if flood.Parent ~= workspace then
flood_control.Disabled = true
spawnP.Enabled = true
end
end
end
then I tried again and did this...
local flood_control = script.Parent:WaitForChild("flood_controller")
local flood = script.Parent
local spawnP = game.Workspace:WaitForChild("MainPlate").SpawnLocation
local sound = script.Parent:WaitForChild("Part"):WaitForChild("Intense Music 4")
for _,v in pairs(flood) do
if v.Parent == workspace then
spawnP.Enabled = false
flood_control.Disabled = false
else
if v.Parent ~= workspace then
spawnP.Enabled = true
flood_control.Disabled = true
end
end
end
and it still didn't work :(

9 comments
What does this have to do with looping through a model?
I put this script into a model
ok, but where in this script do you need to loop through the model and why?
Ok, in your second attempt, you can't check to see if parts in a model are parented to the workspace because you know where they are, they are in the model...
As for looping through the model, that second attempt, answers your question
ok, so how do I know and why won't it work
what do you mean by how do you know? It will do exactly what you tell it to do, there will be no errors in this unless flood doesn't actually exist.
for _, v in pairs(flood:GetChildren())*
Do that and it will work for your second script, SteamG0D doesn't know what he's talking bout...