I want to make a intro for my game using gif. I got the IDs for the decals to make it into a gif. This script is the one that was answered before for an easier way to put all IDs in one thing. The only thing that was changed was word Texture to Image since it was inserted in ImageLabel. Now when I hit Play to see if the .gif is working, all it did was just show the first picture. This is how it is inserted on StarterGui and the script for it:
Set up in StarterGui in Studio:
--StarterGui --ScreenGui --Frame --ImageLabel --Script
Script in GIF for ScreenGui:
local Frames = {251495903,251495914,251495930,251495944,251495974} while wait() do for i,v in pairs (Frames) do script.Parent.Image = "http://www.roblox.com/asset/?id="..v wait(0.05) end end
I will only give you some tips.
Wait() runs at 1/30th of a second. The same speed movie's frames change at. It would make the Gif run more smoothly.
print(wait()) --Prints something like: 0.031636467 print(wait(0.05)) --Prints something like: 0.0512318631
While loops will add lag, do not use them. Instead, use the Heartbeat event in the RunService.
while wait() do print("SPAM") end --Both run at the exact same speed. game:GetService("RunService").Heartbeat:connect(function() print("SPAM") end)
In this script, in pairs is not necessary. Do this instead:
local frame = 1 script.Parent.Image = "http://www.roblox.com/asset/?id="..frames[frame] frame = frame+1
next
. But In Pairs should be used instead of Next
.Frames = {251495903,251495914,251495930,251495944,251495974} --A Table/Array doesn't NEED to be local. local frame = 1 game:GetService("RunService").Heartbeat:connect(function() script.Parent.Image = "http://www.roblox.com/asset/?id="..Frames[frame] frame = frame+1 if frame > #Frames then frame = 1 end end)
Hope this helps!
--Add this after line 4. game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..Frames[frame])