how do i make a slideshow of different decals (kinda like on a block u see a picture and every few minutes it changes
how do i make a decal slide show or just slideshow idk what to call it?
1 answer
What you need
To get started, you need to get in touch with some aspects of the API.
- The while loop
while [condition] do
--code
end
The while loop iterates upon checking a condition. If the given condition is false, the loops ends. Alternatively, if the condition is true the code will continue. But be careful, it is an infinite loop so if you have no yield inside it it can crash your studio.
- The table datatype
local Table = {"decal1","decal2","decal3"}
A table is a data type in Lua that is useful to store multiple values. Their contents can be checked by either indexing the table, using the table's name and the desired index: val1 = Table[1], or by iteration through the pairs, next or ipairs function in a generic for loop.
How you should use these
Create a table full of all of the decal ID's you wish to go through. Then, make a while loop to constantly cycle through the ID's and set the decal.
local decal = workspace.SomeBlock.Decal --This is your decal!
local ids = {"6472847","9184539","1284632","1847543"} --These are your ids
local interval = 1 --This is the time, in seconds, between transitions
while true do --Start the while loop
for _,v in next, ids do --Iterate through your table
decal.Texture = "rbxassetid://"..tostring(v) --Set the texture
wait(interval)
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
