You can use for i=1,(ammount) ... end. but i maked a simple script for detect fires, and delay
You can see of For loop in roblox wiki: For - Wiki
Here is the script:
local copy = script.Parent.Copy
local v = 0
for i=1,#copy.Fires:GetChildren() do
v = v + 1
if copy.Fires[v] ~= nil then
if copy.Fires[v].Middle:FindFirstChild("Fire") then
if copy.Fires[v].Middle.Fire.Enabled == false then
copy.Fires[v].Middle.Fire.Enabled = true
end
end
else
break;
end
wait(1)
end
Or you can simple use:
local copy = script.Parent.Copy
for i=1,#copy.Fires:GetChildren() do
if copy.Fires:FindFirstChild(tostring(i)) then
if copy.Fires[i].Middle.Fire.Enabled == false then
copy.Fires[i].Middle.Fire.Enabled = true
end
end
wait(1)
end
Why did I make this code difficult instead of using [i]? for me I tried with [i] and was not in any way in order so I decided to do this.
Hope it helped :D
2 comments
Here is an answer about looping with iterators that I wrote a while back: https://scriptinghelpers.org/questions/69456/how-does-an-advanced-for-loop-actually-work
wow, thanks!