Quiz by AGBest
Key RequiredUniversal

Quiz by AGBest

Universal Scriptjoey9876ajoey9876a 1.8K views 278 executesUpdated Sep 21, 2025
Unrated
00
Lua Script•149 lines (4241 chars)
local textchat = game:GetService("TextChatService")
local channels = textchat:WaitForChild("TextChannels")
local general = channels.RBXGeneral

local done = {}
local guessed = {}
local points = {}
local connection
local QUIZSTOP = false
local debug = false

local DTB = {
    ["When was roblox fully released?"] = {
        A = "2004",
        B = '2005")',
        C = "2006",
        D = "2007",
        correct = "C"
    },
    ["What coding language does roblox use?"] = {
        A = "Python",
        B = "Luau",
        C = "JavaScript",
        D = "C++",
        correct = "B"
    },
    ["Who is the CEO or roblox?"] = {
        A = "Elon Musk",
        B = "MrBeast",
        C = "Donald Trump",
        D = "David Bazucki",
        correct = "D"
    },
    ["How do you call the basic starteravatar in roblox?"] = {
        A = "Bacon Hair",
        B = "Noob",
        C = "Guest",
        D = "John",
        correct = "A"
    },
    ["What currency was removed from roblox?"] = {
        A = "Tix",
        B = "Robux",
        C = "Points",
        D = "DavidBux",
        correct = "A"
    }
}

local function RandomValue(Table)
    local AllValues = {}

    for Index, Value in pairs(Table) do
        table.insert(AllValues, {
            Index = Index,
            Value = Value
        })
    end

    return AllValues[Random.new():NextInteger(1, #AllValues)]
end

local function chat(msg)
    if debug then
        general:DisplaySystemMessage('<font color="#83d3f9">AGBest:</font> [QUIZ] '..msg)
    else
        general:SendAsync("[QUIZ] " .. msg)
    end
end

chat("hi! this is a roblox quiz!")
task.wait(3)
chat("the rules are simple:")
task.wait(2)
chat("i will ask a question,")
task.wait(2)
chat("there will be 4 answers, A, B, C or D")
task.wait(2)
chat("you chat the correct answer using the first letter,")
task.wait(2)
chat("and also there will be 5 rounds.")
task.wait(2.5)
chat("let's get to the first question:")
task.wait(2.5)
for i = 1, 5 do
    if QUIZSTOP then
        break
    end
    local question = RandomValue(DTB)
    chat("question " .. i .. ": " .. question.Index)
    task.wait(3)
    chat("A) " .. question.Value.A .. " B) " .. question.Value.B .. " C) " .. question.Value.C .. " D) " .. question.Value.D)
    task.wait(3)
    chat("you have 30 seconds!")
    done[i] = false
    guessed[i] = false
    task.defer(function()
        textchat.MessageReceived:Connect(function(msg)
            if not done[i] then
                local message = msg.Text:upper()
                if table.find({'A','B','C','D'}, message) then
                    if message == question.Value.correct then
                        guessed[i] = true
                        done[i] = true
                        if points[msg.TextSource.Name] then
                            points[msg.TextSource.Name] = points[msg.TextSource.Name] + 1
                        else
                            points[msg.TextSource.Name] = 1
                        end
                        task.wait(0.5)
                        chat("yes, " .. msg.TextSource.Name .. "! that's correct! you got +1 point!")
                    else
                        task.wait(0.5)
                        chat("sorry, " .. msg.TextSource.Name .. ", that's incorrect. try again!")
                    end
                end
                if msg.TextSource.UserId == game:GetService("Players").LocalPlayer.UserId then
                    if message == "/QUIZSTOP" then
                        task.wait(0.5)
                        --chat("stopping the quiz!")
                        script:Destroy()
                        QUIZSTOP = true
                        done[i] = true
                        guessed[i] = true
                    end
                end
            end
        end)
        task.wait(30)
        done[i] = true
    end)
    repeat
        task.wait(1)
    until done[i]
    task.wait(1.5)
    if not guessed[i] then
        chat("times up! the correct answer is " .. question.Value.correct .. "!")
    end
    DTB[question.Index] = nil
    task.wait(2.5)
end

task.wait(1)
chat("that's all for now! results:")
task.wait(2.5)
for k, v in pairs(points) do
    chat(k .. ": " .. v)
    task.wait(1.5)
end

Features & Information

Make people do an interactive quiz using the text chat! script originally made by AGBest
#quiz#text chat

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts