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

How do I make some of the decals at a different WatTime speed?

I want like some of the decals to be like 5 seconds speed and the other ones to be like 2 to 4 seconds.

bin = script.Parent
decal = bin.Decal

WaitTime = 5.5 -- Wait 5.5 sec. to each decal

MainSlides = {"http://www.roblox.com/asset/?id=154539172", "http://www.roblox.com/asset/?id=177042272",
"http://www.roblox.com/asset/?id=157119414", "http://www.roblox.com/asset/?id=175271294",
"http://www.roblox.com/asset/?id=198632478"}

function runTable(table, delayTime)
    for i=1,#table do
        decal.Texture = table[i]
        wait(delayTime)
    end
end

while true do
    runTable(MainSlides, WaitTime)
end


I hope you understand what I am asking.

1 answer

✓ Accepted answer

To do this you need to use a dictionary. Dictionaries are essentially tables with keys and values, and rather than indexing the table like table[2] you'd index it by the key, table['Key'].

So, lets make a dictionary with keys of the mainslide IDs, and values of the waitTime.

local bin = script.Parent
local decal = bin.Decal
--The numbers(5.5) are how long to wait for each slide.
local MainSlides = {
["http://www.roblox.com/asset/?id=198632478"] = 5.5
["http://www.roblox.com/asset/?id=175271294"] = 5.5,
["http://www.roblox.com/asset/?id=157119414"] = 5.5, 
["http://www.roblox.com/asset/?id=177042272"] = 5.5,
["http://www.roblox.com/asset/?id=154539172"] = 5.5, 
}

function runTable(tab)
	for i,v in pairs(tab) do
		decal.Texture = i
		wait(v)
	end
end

while wait() do
	runTable(MainSlides)
end

7 comments

0

So, dictionaries is a useful thing to do like this one.

0

Correct.

1

It would probably be cleaner to just store the ID's in the table then concatenate them into the roblox.com/asset string in the loop. Either way works, however.

0

^I actually though about that but then decided against it because it's not completely necessary and I thought it might confuse OP

0

Goulstem? When I tested this out, it went all backwards instead of starting from the first to last.

0

Oh that's weird lemme edit.

0

Try det

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