Make Random Gui Pop Up

I want to make a test that the players can take in my game. A random Gui is picked, appears on the players screen and the player has to pick an answer (the questions are all multiple choice). Then another Gui is randomly picked and so on. However the Gui cannot appear twice and once all the Gui’s have appeared and the player answers all of the questions the test ends. When the test ends it shows them how many questions they got correct. I’m not sure how to tackle this challenge.
Thanks for reading.

3 Likes

Hello, so, you can do

local GUIs = game.ServerStorage.GUIStorage:GetChildren() -- Make a folder for all GUI's!

print(GUIs[math.random(1,#GUIs)].Name)
--This will print the name of a RANDOM gui.

I can help you on some parts, like the Test Correct or Not Correct.

Let me write it up for you real quick!

Let’s say we have a ScreenGui in StarterGui with a Frame and a TextButton and a couple others, the text buttons will be the answers and once you click on them then that’s your answer, here are the TextButtons names:

“Answer1”
“Answer2”
“Answer3”
“Answer4”

Now one of these answers are going to be correct, so let’s write the if statement!

This script is in the The Frame with the Answers

We’re also going to have another Frame that is currently the properties “Visible” is set to false
so make sure you do that. The Frame will be named “ResultsFrame” and it will have a TextLabel in it,
we will name the first TextLabel “CorrectorIncorrect1”

if script.Parent.Answer3.MouseButton1Click then
    script.Parent.Frame.ResultsFrame.Visible = true
    script.Parent.Frame.ResultsFrame.CorrectorIncorrect.Text = "Correct!"

else
    script.Parent.Parent.ResultsFrame.Visible = true
    script.Parent..Parent.ResultsFrame.CorrectorIncorrect.Text = "Wrong!"

Now if you want multiple of these questions just add more TextLabels and name them
"CorrectorIncorrect[1,2,3,etc.]

And then do multiple answers on different guis and then just duplicate the Frame with the answers!

If it doesn’t work contact me with the errors, if it doesn’t have an error try a local script instead of a regular script!