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

how do i make a decal slide show or just slideshow idk what to call it? [closed]

Asked by 7 years ago

how do i make a slideshow of different decals (kinda like on a block u see a picture and every few minutes it changes

Closed as Not Constructive by SimplyRekt, InfinitivePixelsJr, and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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
Ad