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

How do I fix this?

Asked by 9 years ago

I made a script and asked how do I make this in a specific timing. Which I did, but it didn't go in order. I asked that question as well, but what they told me was to put: for i,v in ipairs(tab) do, but all it did was show the bin.Decal only and not the rest. This is the script:

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

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Try this..

Second index in table is time, first is id.

local bin = script.Parent
local decal = bin.Decal

local MainSlides = {
    ["1"] = {'http://www.roblox.com/asset/?id=213163470', 15},
    ["2"] = {'http://www.roblox.com/asset/?id=213486920', 3},
    ["3"] = {'http://www.roblox.com/asset/?id=157656296', 3},
    ["4"] = {'http://www.roblox.com/asset/?id=213486967', 3},
    ["5"] = {'http://www.roblox.com/asset/?id=151111211', 3},
    ["6"] = {'http://www.roblox.com/asset/?id=213487020', 3}
}

function getNumTabs(tab)
    local num = 0
    for i,v in pairs(tab) do num = num + 1 end
    return num
end

function runTable(tab)
    for i = 1,getNumTabs(tab) do
        local currentTab = tab[tostring(i)]
        decal.Texture = currentTab[1]
        wait(currentTab[2])
    end
end

while wait() do
    runTable(MainSlides)
end
0
Thanks bro. User#5689 -1 — 9y
Ad

Answer this question