I’m making a loadingscreen where I have a background image that changes every 10 seconds, using tweens to fade in & out.
I also am preloading asset textures that are in workspace at the same time.
The background loop works perfectly whenever I am not preloading the assets, but as soon as it preloads, then whenever the background would change to a different image it would just not load until the preload function is finished.
I am not preloading any of the background images and I don’t know what the issue exactly is.
Background image loop code:
local BackgroundAnim = coroutine.create(function()
local LastBackground
local TweenIn = TweenService:Create(BackgroundImage, TweenInfo.new(.5, Enum.EasingStyle.Quad), {ImageTransparency = 0})
local TweenOut = TweenService:Create(BackgroundImage, TweenInfo.new(.5, Enum.EasingStyle.Quad), {ImageTransparency = 1})
while true do
local RandomBackground
repeat RandomBackground = LoadingScreenBackgroundImages[math.random(1, #LoadingScreenBackgroundImages)] until RandomBackground ~= LastBackground
LastBackground = RandomBackground
BackgroundImage.Image = RandomBackground
TweenIn:Play()
task.wait(10)
TweenOut:Play()
TweenOut.Completed:Wait()
task.wait(1)
end
end)
Preload code:
local PreloadIteration = 0
local beginT = tick()
ContentProvider:PreloadAsync(TextureList, function(a)
PreloadIteration += 1
Status2.Text = "("..PreloadIteration.."/"..#TextureList..")"
end)
local T = tick() - beginT
Any help is appreciated!