I made a gif script, but I am like getting tired of copying http://www.roblox.com/asset/?id=[ID] to make 23 pics into gifs. Is there a way to just put the id number in there to make it easier for me to paste the id only. This is the script I have been using before with the dancing banana GIf:
01 | while true do |
02 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333727" |
03 | wait( 0.1 ) |
04 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333747" |
05 | wait( 0.1 ) |
06 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333792" |
07 | wait( 0.1 ) |
08 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333817" |
09 | wait( 0.1 ) |
10 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333831" |
11 | wait( 0.1 ) |
12 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333855" |
13 | wait( 0.1 ) |
14 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333875" |
15 | wait( 0.1 ) |
16 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892" |
17 | wait( 0.1 ) |
18 |
19 | end |
I need an easier way where it will be like this: 152333727, 152333747, etc.
Yes, there is.
There are dandy things called Tables
.
Tables are used to store multiple information, with one variable.
To use tables, you only need to do variableName = {}
For example
1 | local table = { "Potato" , "Apple" } |
Now, we have a table with the strings Potato and Apple.
What if we want to access this table? You use these brackets [ ]
Let's see, there are 2 strings in the table, the second one is Apple, I want to access that, so how do I do it?
Like this
1 | print (table [ 2 ] ) --since Apple is the second string in the table, we use 2 to refer to it. |
So how does this apply to your question?
You can store decal ids in a table.
01 | local decalsIds = { 1232131038912 , 000101010101 , 1337360 } |
02 |
03 | function pickdecal(num) |
04 | local decal = Instance.new( "decal" ,game.Workspace.BasePlate) |
05 | decal.Texture = "rbxassetid://" ..soundIds [ num ] |
06 | wait() |
07 | decal:Destroy() |
08 | end |
09 | while true do |
10 | for i,v in pairs (decalsIds) do |
11 | wait() |
12 | pickdecal(i) |
13 | end |
14 | end |
1 | for i = 1 , 23 do |
2 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892" |
3 | wait() |
4 | end |
5 | script:Destroy() |
It will do that function 23 times then it stops
Add the ID's in the table,
01 | assets = { 1324123 , 3525323 , 67686454 } |
02 |
03 | while true do |
04 | repeat |
05 | tst = 1 |
06 | script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=" .. assets [ tst ] |
07 | tst = tst + 1 |
08 | wait(. 1 ) |
09 | until tst = = #assets |
10 | end |
It should work.