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.
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.