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

Is it possible to randomize roblox asset id's?

Asked by 4 years ago

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.

0
maybe you miss type something..? imagoodguysowhat -5 — 4y
0
im pretty sure he didnt BrandonXYZ9 18 — 4y

1 answer

Log in to vote
0
Answered by
moo1210 587 Moderation Voter
4 years ago

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.

0
^^^ royaltoe 5144 — 4y
Ad

Answer this question