Make me a system on roblox studio to where 1st user can set up like a quiz from a GUI whether it can type in answers or multiple choice (2-4 choice options) and then when that first user is done with making their 5 quiz questions Other users go to the brick (that will have a light up indicator to take quiz) and they will be able to take the quiz by clicking the answer choices or typing in an answer
Can we add the quiz creator being able to choose from 5 to 21 questions, a timer, and multiplayer so all players are on the same timer.
The quiz creator will then be able to choose when to start the quiz whenever.
Players will need to be "Ready" by joining to take part in the quiz.
Basically the quiz gets set up, Quiz questions needs to be set up next, Players are then allowed to join to take part, Quiz creator can start the quiz timer for players to take the quiz, Quiz finishes when all players are done or the timer runs out (Timer can 3-6 mins),
Quiz will show all players answers If multiple choice (correct answer choice will be highlighted) and also shows number out of X questions answered correctly
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Insert a Script in ServerScriptService named QuizManager:
lua
Step 3: QuizCreatorGui (LocalScript)
Allows creator to:
Choose number of questions (5-21)
Add questions (typed or MC with 2-4 options)
Set timer (3-6 minutes)
Submit quiz to server
Basic example LocalScript inside QuizCreatorGui:
lua
Step 4: QuizLobbyGui (LocalScript)
Shows players who are ready
Player can toggle ready
Creator can start quiz when ready
lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local PlayerReady = ReplicatedStorage.Remotes:WaitForChild("PlayerReady")
local StartQuiz = ReplicatedStorage.Remotes:WaitForChild("StartQuiz")
local UpdateQuizState = ReplicatedStorage.Remotes:WaitForChild("UpdateQuizState")
local RequestPlayerStatus = ReplicatedStorage.Remotes:WaitForChild("RequestPlayerStatus")
local Gui = script.Parent
local LobbyFrame = Gui.LobbyFrame
local ReadyButton = LobbyFrame.ReadyButton
local StartButton = LobbyFrame.StartButton
local PlayersList = LobbyFrame.PlayersList
local player = Players.LocalPlayer
local isReady = false
local quizCreatorUserId = nil
local function updatePlayersList(playersReady)
PlayersList:ClearAllChildren()
for _, p in pairs(Players:GetPlayers()) do
local ready = playersReady[p.UserId] or false
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1,0,0,20)
label.Text = p.Name .. (ready and " (Ready)" or "")
label.Parent = PlayersList
end
end
ReadyButton.MouseButton1Click:Connect(function()
isReady = not isReady
PlayerReady:FireServer(isReady)
ReadyButton.Text = isReady and "Unready" or "Ready"
end)
StartButton.MouseButton1Click:Connect(function()
if player.UserId == quizCreatorUserId then
StartQuiz:FireServer()
end
end)
UpdateQuizState.OnClientEvent:Connect(function(state, data)
if state == "Lobby" then
LobbyFrame.Visible = true
if data and data.playersReady then
updatePlayersList(data.playersReady)
end
quizCreatorUserId = data and data.creator and Players:GetPlayers()[1] and Players:GetPlayers()[1].UserId or nil
StartButton.Visible = (player.UserId == quizCreatorUserId)
else
LobbyFrame.Visible = false
end
end)
Step 5: QuizTakerGui (LocalScript)
Shows questions one by one
Allows MC or typed answers
Sends answers to server
Shows timer countdown
lua
Step 6: QuizResultsGui (LocalScript)
Shows all players' answers, highlights correct answers, and shows scores.
lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local UpdateQuizState = ReplicatedStorage.Remotes:WaitForChild("UpdateQuizState")
local Gui = script.Parent
local ResultsFrame = Gui.ResultsFrame
local ResultsList = ResultsFrame.ResultsList
local CloseButton = ResultsFrame.CloseButton
local function clearResults()
for _, child in pairs(ResultsList:GetChildren()) do
if child:IsA("Frame") then
child:Destroy()
end
end
end
local function createResultEntry(playerName, answers, quizData)
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1,0,0,30)
frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
frame.Parent = ResultsList
local nameLabel = Instance.new("TextLabel")
nameLabel.Size = UDim2.new(0.3,0,1,0)
nameLabel.Text = playerName
nameLabel.Parent = frame
local score = 0
local total = #quizData.Questions
local answersLabel = Instance.new("TextLabel")
answersLabel.Size = UDim2.new(0.7,0,1,0)
answersLabel.TextXAlignment = Enum.TextXAlignment.Left
local answerTexts = {}
for i, q in ipairs(quizData.Questions) do
local playerAnswer = answers[i] or "No Answer"
local correct = (playerAnswer == q.CorrectAnswer)
if correct then score += 1 end
local text = string.format("Q%d: %s%s", i, playerAnswer, correct and " (Correct)" or " (Wrong)")
table.insert(answerTexts, text)
end
answersLabel.Text = table.concat(answerTexts, " | ")
answersLabel.Parent = frame
local scoreLabel = Instance.new("TextLabel")
scoreLabel.Size = UDim2.new(0, 100, 1, 0)
scoreLabel.Position = UDim2.new(1, -100, 0, 0)
scoreLabel.Text = string.format("%d/%d", score, total)
scoreLabel.Parent = frame
end
UpdateQuizState.OnClientEvent:Connect(function(state, data)
if state == "Results" then
ResultsFrame.Visible = true
clearResults()
local answersData = data.playersAnswers or {}
local quizData = data.quizData
for userId, pdata in pairs(answersData) do
local player = Players:GetPlayerByUserId(userId)
if player then
createResultEntry(player.Name, pdata.answers, quizData)
end
end
else
ResultsFrame.Visible = false
end
end)
CloseButton.MouseButton1Click:Connect(function()
ResultsFrame.Visible = false
end)
Final notes:
You will need to build the GUIs with the described elements and name them accordingly.
The server script manages the quiz lifecycle and synchronizes all players.
The creator sets up the quiz, players ready up, then the creator starts the quiz.
Players answer questions with a shared timer.
Results are shown at the end.
You can expand this with leaderboards, better UI, and error handling.
If you want, I can help you build the exact GUI layouts or provide more detailed scripts for each GUI! Would you like that?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local SubmitNewQuiz = Remotes:WaitForChild("SubmitNewQuiz")
local PlayerReady = Remotes:WaitForChild("PlayerReady")
local SubmitAnswer = Remotes:WaitForChild("SubmitAnswer")
local StartQuiz = Remotes:WaitForChild("StartQuiz")
local UpdateQuizState = Remotes:WaitForChild("UpdateQuizState")
local RequestQuizData = Remotes:WaitForChild("RequestQuizData")
local RequestPlayerStatus = Remotes:WaitForChild("RequestPlayerStatus")
local QuizStation = Workspace:WaitForChild("QuizStation")
local StatusLight = QuizStation:WaitForChild("StatusLight")
local Prompt = QuizStation:WaitForChild("Prompt")
-- Quiz states
local QUIZ_STATE = {
INACTIVE = "Inactive",
SETUP = "Setup",
LOBBY = "Lobby",
RUNNING = "Running",
RESULTS = "Results"
}
local quizState = QUIZ_STATE.INACTIVE
local quizCreator = nil
local quizData = nil -- {Questions = {}, Timer = seconds}
local playersReady = {}
local playersAnswers = {} -- [player.UserId] = {answers = {}, finished = bool}
local quizStartTime = 0
local quizDuration = 0
local timerConnection = nil
-- Helper to update the light and prompt
local function updateStationStatus()
if quizState == QUIZ_STATE.RUNNING then
StatusLight.BrickColor = BrickColor.new("Lime green")
Prompt.Enabled = false
elseif quizState == QUIZ_STATE.LOBBY then
StatusLight.BrickColor = BrickColor.new("Bright yellow")
Prompt.Enabled = true
elseif quizState == QUIZ_STATE.SETUP then
StatusLight.BrickColor = BrickColor.new("Bright blue")
Prompt.Enabled = false
else
StatusLight.BrickColor = BrickColor.new("Really red")
Prompt.Enabled = false
end
end
local function resetQuiz()
quizState = QUIZ_STATE.INACTIVE
quizCreator = nil
quizData = nil
playersReady = {}
playersAnswers = {}
quizStartTime = 0
quizDuration = 0
if timerConnection then
timerConnection:Disconnect()
timerConnection = nil
end
updateStationStatus()
UpdateQuizState:FireAllClients(quizState)
end
-- When creator submits quiz
SubmitNewQuiz.OnServerEvent:Connect(function(player, data)
if quizState ~= QUIZ_STATE.INACTIVE then
player:Kick("Quiz already in progress or setup.")
return
end
-- Validate data
if type(data) ~= "table" or type(data.Questions) ~= "table" or type(data.Timer) ~= "number" then
return
end
local qCount = #data.Questions
if qCount < 5 or qCount > 21 then
return
end
if data.Timer < 180 or data.Timer > 360 then
return
end
quizCreator = player.UserId
quizData = data
quizDuration = data.Timer
quizState = QUIZ_STATE.LOBBY
playersReady = {}
playersAnswers = {}
updateStationStatus()
UpdateQuizState:FireAllClients(quizState, {creator = player.Name, questionCount = qCount, timer = quizDuration})
print("Quiz setup complete by " .. player.Name)
end)
-- Player ready up
PlayerReady.OnServerEvent:Connect(function(player, ready)
if quizState ~= QUIZ_STATE.LOBBY then return end
playersReady[player.UserId] = ready
UpdateQuizState:FireAllClients(quizState, {playersReady = playersReady})
print(player.Name .. " ready status: " .. tostring(ready))
end)
-- Creator starts quiz
StartQuiz.OnServerEvent:Connect(function(player)
if player.UserId ~= quizCreator then return end
if quizState ~= QUIZ_STATE.LOBBY then return end
-- Check if at least one player ready (besides creator)
local readyCount = 0
for uid, ready in pairs(playersReady) do
if ready and uid ~= quizCreator then
readyCount = readyCount + 1
end
end
if readyCount == 0 then
-- No players ready
return
end
quizState = QUIZ_STATE.RUNNING
quizStartTime = os.time()
playersAnswers = {}
updateStationStatus()
UpdateQuizState:FireAllClients(quizState, {startTime = quizStartTime, duration = quizDuration})
-- Start timer
timerConnection = RunService.Heartbeat:Connect(function()
local elapsed = os.time() - quizStartTime
if elapsed >= quizDuration then
timerConnection:Disconnect()
timerConnection = nil
quizState = QUIZ_STATE.RESULTS
UpdateQuizState:FireAllClients(quizState, {playersAnswers = playersAnswers, quizData = quizData})
updateStationStatus()
end
end)
print("Quiz started by creator.")
end)
-- Player submits answer
SubmitAnswer.OnServerEvent:Connect(function(player, questionIndex, answer)
if quizState ~= QUIZ_STATE.RUNNING then return end
if not quizData or not quizData.Questions[questionIndex] then return end
local userId = player.UserId
if not playersAnswers[userId] then
playersAnswers[userId] = {answers = {}, finished = false}
end
playersAnswers[userId].answers[questionIndex] = answer
-- Check if player finished all questions
local totalQuestions = #quizData.Questions
local answeredCount = 0
for i=1,totalQuestions do
if playersAnswers[userId].answers[i] ~= nil then
answeredCount = answeredCount + 1
end
end
if answeredCount == totalQuestions then
playersAnswers[userId].finished = true
end
-- Check if all players finished
local allFinished = true
for uid, ready in pairs(playersReady) do
if ready and uid ~= quizCreator then
if not playersAnswers[uid] or not playersAnswers[uid].finished then
allFinished = false
break
end
end
end
if allFinished then
if timerConnection then
timerConnection:Disconnect()
timerConnection = nil
end
quizState = QUIZ_STATE.RESULTS
UpdateQuizState:FireAllClients(quizState, {playersAnswers = playersAnswers, quizData = quizData})
updateStationStatus()
end
end)
-- Player requests quiz data
RequestQuizData.OnServerInvoke = function(player)
if quizState == QUIZ_STATE.LOBBY or quizState == QUIZ_STATE.RUNNING or quizState == QUIZ_STATE.RESULTS then
return quizData
else
return nil
end
end
-- Player requests their ready status
RequestPlayerStatus.OnServerInvoke = function(player)
return playersReady[player.UserId] or false
end
-- Reset quiz if creator leaves
Players.PlayerRemoving:Connect(function(player)
if player.UserId == quizCreator then
resetQuiz()
end
end)
-- Reset on server start
resetQuiz()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SubmitNewQuiz = ReplicatedStorage.Remotes:WaitForChild("SubmitNewQuiz")
local UpdateQuizState = ReplicatedStorage.Remotes:WaitForChild("UpdateQuizState")
local Gui = script.Parent
local MainFrame = Gui.MainFrame
local questionCountInput = MainFrame.QuestionCountInput -- TextBox for number of questions
local timerInput = MainFrame.TimerInput -- TextBox for timer in seconds
local questionsFrame = MainFrame.QuestionsFrame -- Frame holding question inputs
local submitButton = MainFrame.SubmitButton
local questions = {}
local maxQuestions = 21
local minQuestions = 5
local function validateAndCollect()
local count = tonumber(questionCountInput.Text)
local timer = tonumber(timerInput.Text)
if not count or count < minQuestions or count > maxQuestions then
warn("Invalid question count")
return nil
end
if not timer or timer < 180 or timer > 360 then
warn("Invalid timer")
return nil
end
local collectedQuestions = {}
for i=1,count do
local qFrame = questionsFrame:FindFirstChild("Question"..i)
if not qFrame then
warn("Missing question frame "..i)
return nil
end
local questionText = qFrame.QuestionInput.Text
local qType = qFrame.TypeDropdown.Value -- "MC" or "Typed"
if questionText == "" then
warn("Empty question "..i)
return nil
end
local questionData = {
Question = questionText,
Type = qType,
Options = {},
CorrectAnswer = ""
}
if qType == "MC" then
-- Collect options and correct answer
for j=1,4 do
local opt = qFrame:FindFirstChild("Option"..j)
if opt and opt.Text ~= "" then
table.insert(questionData.Options, opt.Text)
end
end
local correctIndex = tonumber(qFrame.CorrectOptionInput.Text)
if not correctIndex or correctIndex < 1 or correctIndex > #questionData.Options then
warn("Invalid correct option for question "..i)
return nil
end
questionData.CorrectAnswer = questionData.Options[correctIndex]
else
local typedAnswer = qFrame.TypedAnswerInput.Text
if typedAnswer == "" then
warn("Empty typed answer for question "..i)
return nil
end
questionData.CorrectAnswer = typedAnswer
end
table.insert(collectedQuestions, questionData)
end
return {
Questions = collectedQuestions,
Timer = timer
}
end
submitButton.MouseButton1Click:Connect(function()
local quiz = validateAndCollect()
if quiz then
SubmitNewQuiz:FireServer(quiz)
MainFrame.Visible = false
end
end)
-- Listen for quiz state updates to hide/show creator GUI
UpdateQuizState.OnClientEvent:Connect(function(state)
if state == "Inactive" then
MainFrame.Visible = true
else
MainFrame.Visible = false
end
end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local SubmitAnswer = ReplicatedStorage.Remotes:WaitForChild("SubmitAnswer")
local UpdateQuizState = ReplicatedStorage.Remotes:WaitForChild("UpdateQuizState")
local RequestQuizData = ReplicatedStorage.Remotes:WaitForChild("RequestQuizData")
local Gui = script.Parent
local TakerFrame = Gui.TakerFrame
local QuestionLabel = TakerFrame.QuestionLabel
local MCOptionsFrame = TakerFrame.MCOptionsFrame
local TypedInput = TakerFrame.TypedInput
local SubmitTypedButton = TakerFrame.SubmitTypedButton
local TimerLabel = TakerFrame.TimerLabel
local ScoreLabel = TakerFrame.ScoreLabel
local player = Players.LocalPlayer
local quizData = nil
local currentQuestionIndex = 1
local answers = {}
local quizStartTime = 0
local quizDuration = 0
local timerConnection = nil
local function showQuestion(index)
local q = quizData.Questions[index]
if not q then
-- Quiz finished
TakerFrame.Visible = false
return
end
QuestionLabel.Text = q.Question
if q.Type == "MC" then
MCOptionsFrame.Visible = true
TypedInput.Visible = false
SubmitTypedButton.Visible = false
-- Show options
for i, btn in pairs(MCOptionsFrame:GetChildren()) do
if btn:IsA("TextButton") then
if q.Options[i] then
btn.Text = q.Options[i]
btn.Visible = true
btn.MouseButton1Click:Connect(function()
answers[index] = btn.Text
SubmitAnswer:FireServer(index, btn.Text)
currentQuestionIndex += 1
showQuestion(currentQuestionIndex)
end)
else
btn.Visible = false
end
end
end
else
MCOptionsFrame.Visible = false
TypedInput.Visible = true
SubmitTypedButton.Visible = true
SubmitTypedButton.MouseButton1Click:Connect(function()
local answer = TypedInput.Text
if answer ~= "" then
answers[index] = answer
SubmitAnswer:FireServer(index, answer)
currentQuestionIndex += 1
showQuestion(currentQuestionIndex)
end
end)
end
end
local function updateTimer()
local elapsed = os.time() - quizStartTime
local remaining = math.max(0, quizDuration - elapsed)
TimerLabel.Text = "Time Left: " .. remaining .. "s"
if remaining <= 0 then
if timerConnection then
timerConnection:Disconnect()
timerConnection = nil
end
TakerFrame.Visible = false
end
end
UpdateQuizState.OnClientEvent:Connect(function(state, data)
if state == "Running" then
quizData = data.quizData or RequestQuizData:InvokeServer()
quizStartTime = data.startTime or os.time()
quizDuration = data.duration or 180
currentQuestionIndex = 1
answers = {}
TakerFrame.Visible = true
if timerConnection then
timerConnection:Disconnect()
end
timerConnection = RunService.Heartbeat:Connect(updateTimer)
showQuestion(currentQuestionIndex)
else
TakerFrame.Visible = false
if timerConnection then
timerConnection:Disconnect()
timerConnection = nil
end
end
end)