Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there an easier way for this script?

Asked by 10 years ago

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:

01while true do
02script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333727"
03wait(0.1)
04script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333747"
05wait(0.1)
06script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333792"
07wait(0.1)
08script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333817"
09wait(0.1)
10script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333831"
11wait(0.1)
12script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333855"
13wait(0.1)
14script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333875"
15wait(0.1)
16script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892"
17wait(0.1)
18 
19end

I need an easier way where it will be like this: 152333727, 152333747, etc.

4 answers

Log in to vote
10
Answered by 10 years ago

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

1local 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

1print(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.

01local decalsIds = {1232131038912,000101010101,1337360}
02 
03function pickdecal(num)
04    local decal = Instance.new("decal",game.Workspace.BasePlate)
05    decal.Texture = "rbxassetid://"..soundIds[num]
06    wait()
07    decal:Destroy()
08end
09while true do
10    for i,v in pairs(decalsIds) do
11        wait()
12        pickdecal(i)
13    end
14end
3
Remember that you need to use `ipairs` if the order matters! BlueTaslem 18071 — 10y
0
Destroying the decal constantly is unnecessary. You can just create one decal and override its TextureId for each iteration. I also suggest syncing to RenderStepped for the duration of the gif so its synchronized to framerate. Unclear 1776 — 10y
0
Thank you so much man. I am glad you got positive votes on you LegitimatlyMe. RobotChitti 167 — 10y
Ad
Log in to vote
-3
Answered by
xuefei123 214 Moderation Voter
10 years ago
1for i = 1, 23 do
2script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892"
3wait()
4end
5script:Destroy()

It will do that function 23 times then it stops

0
Thank you too, but please watch out for your rep. Because one of my friend had -64 rep and got suspended for it. And he can't get it like unsuspeded. So watch out bro :D RobotChitti 167 — 10y
0
I know, thanks xuefei123 214 — 10y
Log in to vote
-4
Answered by 10 years ago

ID's in the table is the best way I would know it by

Log in to vote
-5
Answered by
Traide -2
10 years ago

Add the ID's in the table,

01assets = {1324123,3525323,67686454}
02 
03while true do
04repeat
05tst = 1
06script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=" .. assets[tst]
07tst = tst + 1
08wait(.1)
09until tst == #assets
10end

It should work.

0
It didn't work. RobotChitti 167 — 10y

Answer this question