hey! i’m creating a loading screen that cycles through three images. my script seems normal however only images 2 and 3 loop while image 3 doesn’t appear at all. i’m sure what to do/fix, please help! i believe that it is leaving room for the 3rd picture since there is a longer pause for picture 2, but it just isn’t showing up. here is the video:
(SCRIPT BELOW)
local loading2 = script.Parent.ScreenGui2.loading2
local loading3 = script.Parent.ScreenGui3.loading3
while true do
loading1.ImageTransparency = 1
if loading1.ImageTransparency == 1 then
loading2.ImageTransparency = 0
else
loading3.ImageTransparency = 0
end
wait(1)
loading2.ImageTransparency = 1
if loading2.ImageTransparency == 1 then
loading1.ImageTransparency = 0
else
loading3.ImageTransparency = 0
end
wait(1)
loading3.ImageTransparency = 1
if loading3.ImageTransparency == 1 then
loading1.ImageTransparency = 0
else
loading2.ImageTransparency = 0
end
wait(1)
end
local loading2 = script.Parent.ScreenGui2.loading2
local loading3 = script.Parent.ScreenGui3.loading3
while true do
loading1.ImageTransparency = 1
loading2.ImageTransparency = 0
wait(1)
loading2.ImageTransparency = 1
loading3.ImageTransparency = 0
wait(1)
loading3.ImageTransparency = 1
loading1.ImageTransparency = 0
wait(1)
end
The main thing is that you were making it so if the image transparency of loading2 is 1, it sets the imagetransparency of loading1 to 0, not loading3, also your if statements are not really needed since the conditions are always going to evaluate to the truthy condition, never the one in the else.
Unless you need the if statements, just change
if loading2.ImageTransparency == 1 then
loading1.ImageTransparency = 0
else
loading3.ImageTransparency = 0
end
To
if loading2.ImageTransparency == 1 then
loading3.ImageTransparency = 0
else
loading1.ImageTransparency = 0
end
Anytime! If you have anymore issues don’t be afraid to make another post!
Also, I do recommend checking out what @centau_ri had mentioned as you do hae a bit of repetition going on! Although I’d change i, image to _, image to show me and readers that I am not using that 1st given parameter, and it should be ImageTransparency, not Transparecy, so
for _, image in ipairs(array) do
image.ImageTransparency = 0
wait(1)
image.ImageTransparency = 1
end