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 9 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:

while true do 
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333727" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333747" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333792" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333817" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333831" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333855" 
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333875"
wait(0.1)
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892"
wait(0.1)

end 

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

4 answers

Log in to vote
10
Answered by 9 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

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

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.

local decalsIds = {1232131038912,000101010101,1337360}

function pickdecal(num)
    local decal = Instance.new("decal",game.Workspace.BasePlate)
    decal.Texture = "rbxassetid://"..soundIds[num]
    wait()
    decal:Destroy()
end
while true do
    for i,v in pairs(decalsIds) do
        wait()
        pickdecal(i)
    end
end
3
Remember that you need to use `ipairs` if the order matters! BlueTaslem 18071 — 9y
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 — 9y
0
Thank you so much man. I am glad you got positive votes on you LegitimatlyMe. RobotChitti 167 — 9y
Ad
Log in to vote
-3
Answered by
xuefei123 214 Moderation Voter
9 years ago
for i = 1, 23 do
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=152333892"
wait()
end
script: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 — 9y
0
I know, thanks xuefei123 214 — 9y
Log in to vote
-4
Answered by 9 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
9 years ago

Add the ID's in the table,

assets = {1324123,3525323,67686454}

while true do
repeat
tst = 1
script.Parent.Decal.Texture = "http://www.roblox.com/asset/?id=" .. assets[tst]
tst = tst + 1
wait(.1)
until tst == #assets
end

It should work.

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

Answer this question