How would I do a random key mini-game?

Honestly, I just need the general concept. In many games with progression something that has popped out to me is how some of the trainings differ from each other, and one of the biggest ones I have seen that are the most interesting to me are ones such as the random key mini-game.

Something like that (BTW, this is most definitely not my work and I would like to give credits to Quandale Dingle#5000)

But anyways, my general point is how would similar to that be achieved?

I would create a table of acceptable keys, and then randomly choose from that table. I would then check userinput service to see if the keypressed matches the chosen key.

Something like this,

Local ChangeLetter()
 chosenkey = LetterTable[math.random(1,#LetterTable)]
--change gui to show chosenkey


------userinputservice connection here
If keydown.KeyCode == enum.KeyCode[chosenkey] then
--award points or something
1 Like

Could I do the UIS on the same GUI local script? (I’m just a bit confused as I’m kind of thinking about how I want this to really work.)