Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a GIF run ,using a script , on a brick?

I have this GIF that I put on a brick and it does not appear. Help

-- Scripted by Qwerty1806, decals uploaded by Skattzers.
-- 2014:07:14	<-- This is how you're supposed to write dates according to international standards.

FPS = 30 -- How many frames per second it will run at. Maximum is 30 due to engine restrictions.
GIF = {"http://www.roblox.com/asset/?id=501188818","http://www.roblox.com/asset/?id=501190397","http://www.roblox.com/asset/?id=501191077","http://www.roblox.com/asset/?id=501191870","http://www.roblox.com/asset/?id=501192599","http://www.roblox.com/asset/?id=501203072","http://www.roblox.com/asset/?id=501203486","http://www.roblox.com/asset/?id=501204395","http://www.roblox.com/asset/?id=501205681","http://www.roblox.com/asset/?id=501212718","http://www.roblox.com/asset/?id=501213790","http://www.roblox.com/asset/?id=501214670","http://www.roblox.com/asset/?id=501214670","http://www.roblox.com/asset/?id=501215080","http://www.roblox.com/asset/?id=501188818"} 
script.Parent:WaitForChild("Decal")
Image = script.Parent.Decal
-- Did you know GIF is supposed to be pronounced JIF?

for N,F in ipairs(GIF) do
	game:GetService("ContentProvider"):Preload(F) -- This preloads each decal, so you don't have to deal with flashing decals.
end

while true do
	for N,F in ipairs(GIF) do -- Run through the GIF table.
		Image.Texture = "http://www.roblox.com/asset/?id=501188818"
		wait(1/FPS)
	end
end

2 answers

Image.Texture = "http://www.roblox.com/asset/?id=501188818"

You just set it to the same frame each time. Therefore it won't change.

Instead, set it to the current value in the table that the loop is at.

for index, value in ipairs(GIF) do -- Run through the GIF table.
	Image.Texture = value
	wait(1/FPS)
end

In the while true do loop, you are simply displaying the same image instead of cycling through each

Try this:

while true do
    for N=1, #GIF do -- Run through the GIF table.
        Image.Texture = GIF[N]
        wait(1/FPS)
    end
end

This simply cycles through each image of the table. #GIF simply gets the amount of items in the table (in this case 15)

This discussion is preserved as it was. New answers, comments, and votes are closed.