I have a script that changes ImageLabels per specified amount of time. It helps an object look “animated”.
local Mainimage = script.Parent.ImageLabel
local imageIds = {
"rbxassetid://15749106215",
"rbxassetid://15749107556",
"rbxassetid://15749108703",
"rbxassetid://15749110029",
"rbxassetid://15749111322",
"rbxassetid://15749112560",
"rbxassetid://15749113597",
"rbxassetid://15749115044",
"rbxassetid://15749116243",
"rbxassetid://15749117520",
"rbxassetid://15749118634",
"rbxassetid://15749119967",
"rbxassetid://15749121269",
"rbxassetid://15749124939",
"rbxassetid://15749126342",
"rbxassetid://15749127761",
"rbxassetid://15749129257",
"rbxassetid://15749130502"
}
while true do
for _, imageId in ipairs(imageIds) do
Mainimage.Image = imageId
wait(0.1)
end
end
That was the original code, so I’ve added a preloading asset function:
local Mainimage = script.Parent.ImageLabel
local imageIds = {
"rbxassetid://15749106215",
"rbxassetid://15749107556",
"rbxassetid://15749108703",
"rbxassetid://15749110029",
"rbxassetid://15749111322",
"rbxassetid://15749112560",
"rbxassetid://15749113597",
"rbxassetid://15749115044",
"rbxassetid://15749116243",
"rbxassetid://15749117520",
"rbxassetid://15749118634",
"rbxassetid://15749119967",
"rbxassetid://15749121269",
"rbxassetid://15749124939",
"rbxassetid://15749126342",
"rbxassetid://15749127761",
"rbxassetid://15749129257",
"rbxassetid://15749130502"
}
-- Preload images
local preloadedImages = {}
for _, imageId in ipairs(imageIds) do
local preloadImage = Instance.new("ImageLabel")
preloadImage.Image = imageId
preloadImage.Visible = false
preloadImage.Parent = script.Parent
table.insert(preloadedImages, preloadImage)
end
local currentIndex = 1
while true do
-- Display preloaded image
Mainimage.Image = preloadedImages[currentIndex].Image
Mainimage.Visible = true
-- Increment index or reset to 1 if end of list is reached
currentIndex = currentIndex + 1
if currentIndex > #preloadedImages then
currentIndex = 1
end
wait(0.1)
end
But that did not solve the issue. It’s still flickering and if it was a pre-loading issue, they should have worked after they have been already displayed once, no?
This script runs constantly without stopping, it’s to animate a 2D world object (nextbot).
It’s only happening on mobile devices and not on PC nor Studio’s mobile device player.