Gif Flickering?

Hi, I have a bunch of decals and have tried to re-create the ROBLOX intro on a game. However my images are really flashy Can anyone help with this?
(Click here for code, it is too long for the DevForum)
PS: it is roblox making it flash not my images

1 Like

I think this is because of slow internet.
May be the decals were not completely loaded.

So there is a delay for loading it.

1 Like

Nope, Not the case. If I added like 10k decals with the texture on, it worked fine however the game was REALLY laggy.

2 Likes

there’s always a delay for loading assets, unless you preload them, when they’re used for the first time they usually lag behind a bit

1 Like

You could decrease the lenght of the code by having a for i loop.

for i = 1,900 do
   if i < 10 then
      script.Parent.Texture =  "rbxgameasset://Images/output_00"..i
  elseif i >= 100 then
      script.Parent.Texture =  "rbxgameasset://Images/output_"..i
  elseif i >= 10 then
      script.Parent.Texture =  "rbxgameasset://Images/output_0"..i
  end
   wait(waitamt) 
end

there are way faster ways than this, but im not that experienced in string stuff.

1 Like

Try using a spritesheet, it is so much easier to do this. Scale Spritesheet Iteration

1 Like

You can reduce it more. The i comparisons are not needed. Just add padding to the number.

for i = 1, 899 do
    i = ("0000" .. i):sub(-4)-- the concept is that it grabs the last 4 digits. so if `i` is 1 you get "00001":sub(-4); which is 0001. 
    script.Parent.Texture = "rbxgameasset://Images/output_" .. i
    wait(waitamt)
end

I believe the issue with the code is that you’re doing this on the server and there is latency between the assignment of the images.

2 Likes

Appreciate it but it is a lot of work for 900 frames. (uploading them)

I would honestly wait for videoframes to be released to do this, that is a lot of frames that belong in a video, not a gif.

The reason it lags is because your code is inefficient. You should use a sprite sheet for the most performance possible. Optionally do a loop.

Either way I think you should just use an external library. Here is a pretty good one that does the job and is performant.