I have a folder with different layers of a platform. Each layer is a model named 1-19 and each layer is consisted of parts or “Tiles”. I’m trying to write a function to perform operations at the same time for each tile on a serversided script. The tiles will be individually all be doing something at the same time and I will eventually drop off the layers at specific times. However, I’m stuck on the first while loop.
Layer(folder) — > Model1-19 — > x amount of Tiles
I tried using for num, child in pairs(model.GetDescendent()) do originally, however that didn’t work and I have no clue what I’m able to do from here.
local model = script.Parent local Layer1 = model["1"] local GAME_START = game.Workspace.GameStart local GAME_ACTIVE = true local timer = 15 while GAME_ACTIVE == true do for index = 1, #model do --- trying random stuff here for num, child in pairs(index:GetChildren()) do FallEvent = math.random(0,1) RiseEvent = math.random(0,4) BlockWait = math.random(0,10) BlockWait1 = math.random(2,6) if FallEvent == 0 then wait(BlockWait) child.BrickColor = BrickColor.new("Crimson") wait(2) child.Transparency = 1 child.CanCollide = false wait(2) child.Transparency = 0 child.CanCollide = true child.BrickColor = BrickColor.new("Medium stone grey") end end end end while GAME_ACTIVE == true do while timer > 0 do wait(1) timer = timer - 1 print(timer) if timer == 0 then for num, child in pairs(Layer1:GetChildren()) do child.Transparency = 1 child.CanCollide = false end end end end