Perhaps order them in a table using something like:
local Images = {}
local Iteration = 0
local Previous = [randomly choose an image]
for i=1, 21 do
Iteration += 1
local Image = parent:FindFirstChild("Img"..Iteration)
table.insert(Images, Iteration, Image)
end
Then loop the table.
Itâs more just housekeeping though.
The âpreviousâ local could be updated for each image change, then hidden on the next one.
The loop here will just change pick out an image at random order. @Irideon 's solution would be a more reasonable solution. Although in @Irideon 's solution, the line Iteration += 1 will run first and change the 1 to 2; this also skips âImg0.â To add on, this would be a good solution:
local Children = script.Parent:GetChildren()
for i = 1, #Children, 1 do
script.Parent["Img"..tostring(i - 1)].Visible = true
wait(0.02)
script.Parent["Img"..tostring(i - 1)].Visible = false
end
I checked out on that and you are wrong on that one. It will select the ImageLabel in the correct order. So my script is the simplest, smallest and the most efficient one. It depends on how the image labels are placed. If they are placed in a different order use this script -
for i = 0, #script.Parent:GetChildren() - 1 do
script.Parent["Img"..tostring(i)].Visible = true
wait(0.02)
script.Parent["Img"..tostring(i)].Visible = false
end
@KaylaPls This script shall help you. The posts above me by different people also work perfectly.
First of all, I wasnât wrong. The for loop doesnât always get the contents in correct order. Second of all, I have no idea why you just rescripted my solution and posted it again.
local function loop()
for i = 0, #script.Parent:GetChildren() - 1 do
script.Parent["Img"..tostring(i)].Visible = true
wait(0.02)
script.Parent["Img"..tostring(i)].Visible = false
end
end
while true do
if script.Parent.Parent.Parent.Model.Flip18.Value == true then
loop()
else
wait(0.02)
end
end
Is this what you meant to say?
If you mean to say that Visible is not being not ticked when using the script then either the wait is too short. Increase the wait to around 1 second and then see. Or you are looking inside the StartGui while in game, you shall look inside your player gui that is inside your Player in game.Players. Inside there, Visible is being ticked and unticked.
Can you also send a picture of the place where the script is located inside the Explorer. Just send a screenshot of the StarterGui in the explorer showing its components if you dont mind