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

What is wrong with this script?

I asked this question before, and it worked :D. But when I tried it out, it went like out of order. Instead of starting from the first to the last, it did it backward. What is wrong with it?

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=213163470"] = 15, 
["http://www.roblox.com/asset/?id=213486920"] = 3,
["http://www.roblox.com/asset/?id=157656296"] = 3,
["http://www.roblox.com/asset/?id=213486967"] = 3, 
["http://www.roblox.com/asset/?id=151111211"] = 3,
["http://www.roblox.com/asset/?id=213487020"] = 3
}

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

while wait() do
    runTable(MainSlides)
end

1 answer

✓ Accepted answer

Line 14 says for i,v in pairs(tab) do This will iterate through the table in some weird order. Instead use ipairs which means iterated pairs. This will go through the table in order.

for i,v in ipairs(tab) do

2 comments

0

Thanks bro. :D

0

Okay, I tested it out, but it is like froze. It only shows the decal of it.

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