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 fix this?

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

✓ Accepted answer

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

1 comment

0

Thanks bro.

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