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

Is there an easier way for this script?

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

✓ Accepted answer

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 comments

3

Remember that you need to use ipairs if the order matters!

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.

0

Thank you so much man. I am glad you got positive votes on you LegitimatlyMe.

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

2 comments

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

0

I know, thanks

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

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.

1 comment

0

It didn't work.

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