Hi devs, i got a problem with one of my script. On pc everything work but on mobile the changing images are making the screen pop . Someone can help me?
( VHS effect )
Pc :
Mobile :
Script :
function calculate()
local x = math.random(0,10)
if x == 0 then
script.Parent.Image = "rbxassetid://2297482648"
elseif x == 1 then
script.Parent.Image = "rbxassetid://2297483662"
elseif x == 2 then
script.Parent.Image = "rbxassetid://2297484608"
elseif x == 3 then
script.Parent.Image = "rbxassetid://2297485059"
elseif x == 4 then
script.Parent.Image = "rbxassetid://2297485539"
elseif x == 5 then
script.Parent.Image = "rbxassetid://2297486750"
elseif x == 6 then
script.Parent.Image = "rbxassetid://2297487096"
elseif x == 7 then
script.Parent.Image = "rbxassetid://2297487323"
elseif x == 8 then
script.Parent.Image = "rbxassetid://2297488547"
elseif x == 9 then
script.Parent.Image = "rbxassetid://2297488547"
elseif x == 10 then
script.Parent.Image = "rbxassetid://2297488944"
end
end
while true do
wait(0.1)
calculate()
end
I think you should set ScreenInsets on the ScreenGui to none, and I think the problem is that you’re on the Studio on PC, which already have those images pre-loaded. To fix this, you should store those images first somewhere in ReplicatedStorage, so the mobile client already has the images loaded without it temporarily displaying an empty image.
Okay but like how can i show it ? Can u send me a script example?
Bdw i changed the script :
local ContentProvider = game:GetService("ContentProvider")
local assetIDs = {
"rbxassetid://2297482648",
"rbxassetid://2297483662",
"rbxassetid://2297484608",
"rbxassetid://2297485059",
"rbxassetid://2297485539",
"rbxassetid://2297486750",
"rbxassetid://2297487096",
"rbxassetid://2297487323",
"rbxassetid://2297488547",
"rbxassetid://2297488944"
}
for _, assetID in pairs(assetIDs) do
ContentProvider:PreloadAsync({assetID})
end
local imageLabel = script.Parent
while true do
wait()
local x = math.random(1, #assetIDs)
local selectedAssetID = assetIDs[x]
imageLabel.Image = selectedAssetID
end