What I want to do is make an infinite loop of decals like this:
while true do
wait(.1) firstdecal wait(.1) seconddecal wait(.1) thirddecal wait(.1) fourthdecal
end
How do I do this?
What I want to do is make an infinite loop of decals like this:
while true do
wait(.1) firstdecal wait(.1) seconddecal wait(.1) thirddecal wait(.1) fourthdecal
end
How do I do this?
You pretty much have the right idea, however to make this a bit cleaner, we can use for loops and tables inside the while loop instead.
If you don't know what tables or for loops are, I highly suggest you check out these sources on them before I continue:
Tables - http://wiki.roblox.com/index.php?title=Table#string.format
For loops - http://wiki.roblox.com/index.php?title=Loops#string.format
Scenario
Now because you didn't really specify what you want to do with these decals, I'm just going to give an example of creating one on a part, and changing it's asset id every tenth of a second.
local Part = Instance.new("Part",workspace) -- New part in the workspace
local Decal = Instance.new("Decal",Part) -- New decal in the part
-- Table that holds all of our decal images
local Assets = {}
-- While loop to keep the cycle repeating itself
while true do
-- As DevSean pointed out, this would probably be a nice little feature to add if your asset table is empty.
if #Assets > 0 then
-- For loop to iterate through the Assets table, with "i" representing the keys, and "v" representing the value.
for i,v in pairs(Assets) do
Decal.Texture = v -- Assign the texture of the decal to the new "v" asset
wait(0.1) -- Wait a tenth of a second
end
-- Else, meaning is the asset table is empty, then...
else
-- And perhaps we could add this wait here if your asset table is empty, maybe in case you want to insert some assets into your table at some other place in your script.
wait()
end
end
Honestly, I'd explain a lot more, but if I where to go in depth about every detail I wrote above, I'd run out of characters to answer this question. So if you have any questions specifically about what I wrote above, just leave a comment or message me on my ROBLOX account and I'll get to it ASAP.
It could be worth adding if (#Assets ~= 0) then while true do to make sure it doesn't crash the server/client if someone forgets to add asset id's, it would also be better to do Decal.Texture = ""http://www.roblox.com/asset/?id="..v so you don't have to store full asset urls
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Change the Transparency.