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

Is it possible to randomize roblox asset id's?

So im currently working on a heist game and I want it so when you pick a crew it chooses a random picture of a roblox character. I made decals of all the roblox characters and now im trying to make a randomizer so it picks a random one out of the 100. But the code im using just doesnt work, i have tried to fix it for 4 hours and it just wont work. Heres my code but without all of the unrelated stuff.

crewsmenu.Crew1V.Value = math.random(1,100)
crewsmenu.Crew2V.Value = math.random(1,100)
crewsmenu.Crew3V.Value = math.random(1,100)
print(crewsmenu.Crew1V.Value)
print(crewsmenu.Crew2V.Value)
print(crewsmenu.Crew3V.Value)
wait(.1)
crewsmenu.Crew1.Image = crewsmenu.CrewImages.crewleader["crewsmenu.Crew1V.Value"].Value

Note that i have this in starter gui and that I have all the image id's in a folder using intvalue's.

2 comments

0

maybe you miss type something..?

0

im pretty sure he didnt

1 answer

✓ Accepted answer

You could use math.random and an array to do that. Example:

local decals = {2522774790,73737626} --decals separated by commas

local random = math.random(1,#decals)

print(decals[random])

This will print one of the ids from the list.

1 comment

0

^^^

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