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

HOW TO CHOOSE A RANDOM IMAGE?

I've made a script that is practically the game intro/ loading screen and I want it to randomly select a photo from a library I give it within the same script and put it as the image of the photo, idk how to tho

1 answer

✓ Accepted answer
local images = {} --put image ids here, separated by a comma like {"1234", "5678",} 

local chosen_image = images[math.random(#images)] --Picks a random entry in the images table

chosen_image = "rbxassetid://".. chosen_image --Turns the ID into a url for use


Hope I helped :)

3 comments

1

Yeah it's a massive help, now I can just add a line like script.Parent.image = chosen_image to make it change the photo?

0

Yea

0

seems like I ran into trouble with that since it didn't change the actual photo it doesnt do anything

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