so i am making a transition for my game which has 77 frames. i want the frames to be visible in a chronological order but it doesn’t! i don’t know what to do so i would appreciate the help!
Script (part where i have the problem):
local gui = plr.PlayerGui
local transition = gui.Transition
for i, v in pairs(transition:GetChildren()) do
v.Visible = true
wait()
end
Here’s a more dynamic solution that’ll work with any number of children.
local children = transition:GetChildren()
table.sort(children, function(Left, Right)
return tonumber(Left.Name) < tonumber(Right.Name)
end)
for _, child in ipairs(children) do
child.Visible = true
task.wait()
end
In that case, you could just use a generic loop and have it end at the number of children without having to sort through each child as that is essentially what your solution does.
Might look something like this:
local children = transition:GetChildren()
for i = 1, #children do
transition[i].Visible = true --Concatenate if the frames have a prefix/suffix in their name
task.wait()
end
Purposefully avoided doing this in case there were gaps, i.e; transition[10] didn’t exist. You could use transition:FindFirstChild[i] to remedy that though.