I have a script and it's supposed to be playing a gif. So I have 48 frames and I've only gotten 25 for now. When I test it, the photo starts blinking. At first I thought it was that it wasn't loading. I checked the output and it says something like this:
21:29:17.565 - Image failed to load: http://www.roblox.com/asset/?id=230054930: Failed to resolve texture format
Can anyone help?
Code
01 | frames = { 230020795 , 230021055 , 230022130 , 230023083 , 230023938 , 230024173 , 230024269 , 230024742 , 230025991 , 230026076 , 230028638 , 230028781 , 230028829 , 230028881 , 230028915 , 230054690 , 230054720 , 230054806 , 230054865 , 230054930 , 230055354 , 230055573 , 230055616 , 230055672 , 230055788 } |
02 |
03 | function run() |
04 | for i = 1 ,#frames do |
05 | script.Parent.Image = "http://www.roblox.com/asset/?id=" ..frames [ i ] |
06 | wait() |
07 | end |
08 | run() |
09 | end |
10 |
11 | run() |
Your question has already been answered in the comments, but here is an example of how I would program this:
01 | frames = { --[[{ assetId, timeToDisplay}]] |
02 | { 230020795 , . 02 } ; { 230021055 , . 05 } -- and so on |
03 | } |
04 |
05 | local step = game:GetService( "RunService" ).Heartbeat |
06 | local st = tick() |
07 | local curFrame = 1 |
08 | while true do |
09 | local t = tick() |
10 | if t - st > = frames [ curFrame ] [ 2 ] then |
11 | st = t |
12 | curFrame = curFrame + 1 |
13 |
14 | script.Parent.Image = "rbxassetid://" .. frames [ curFrame ] [ 1 ] |
15 | end |
16 |
17 | step:wait() |
18 | end |
It seems that your question has already been answered, but as a quick note, rather than typing out that URL, you can also just use rbxassetid://<asset id>