Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I am trying to make a random decal and I am completely confused?

I have no idea how to do this. I am trying to do a completely random decal (while true do too)

b = {"http://www.roblox.com/asset/?id=math.random..(1, 9999999)"}
decal = script.Parent.Decal

while true do
	local a = math.random(1, #b)
	decal.Texture = b[a]
	wait(3)
end

1 answer

✓ Accepted answer

There is a good chance nothing will load because there is a chance it isn't an image.

It isn't working because there is only one thing in your b table. Fix this by making a table of assetIds from 1 to 9999999 or just pick a random number when you call the a variable.

They both seem to achieve the same thing, why not go for the simpler method.

while true do
	local randomAsset = "http://www.roblox.com/asset/?id=" .. math.random(1, 999999)
	decal.Texture = randomAsset
	wait(3)
end

Good luck.

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