Not a member of GistPad yet?
Sign Up,
it unlocks many cool features!
- local P = game:GetService("Players")
- local R = game:GetService("ReplicatedStorage")
- local T = game:GetService("TextChatService")
- local LP = P.LocalPlayer
- local PG = LP:WaitForChild("PlayerGui")
- if PG:FindFirstChild("DQuiz") then PG.DQuiz:Destroy() end
- local SG = Instance.new("ScreenGui")
- SG.Name = "DQuiz"
- SG.Parent = PG
- SG.ResetOnSpawn = false
- local F = Instance.new("Frame")
- F.Parent = SG
- F.BackgroundColor3 = Color3.fromRGB(30,30,35)
- F.Position = UDim2.new(0.1, 0, 0.2, 0)
- F.Size = UDim2.new(0, 220, 0, 140)
- F.Active = true
- F.Draggable = true
- local C1 = Instance.new("UICorner")
- C1.CornerRadius = UDim.new(0, 12)
- C1.Parent = F
- local TL = Instance.new("TextLabel")
- TL.Parent = F
- TL.BackgroundTransparency = 1
- TL.Size = UDim2.new(1, 0, 0, 35)
- TL.Font = Enum.Font.GothamBold
- TL.Text = "Delta Trivia Bot"
- TL.TextColor3 = Color3.fromRGB(255, 255, 255)
- TL.TextSize = 16
- local SL = Instance.new("TextLabel")
- SL.Parent = F
- SL.BackgroundTransparency = 1
- SL.Position = UDim2.new(0, 0, 0, 35)
- SL.Size = UDim2.new(1, 0, 0, 25)
- SL.Font = Enum.Font.Gotham
- SL.Text = "System Idle"
- SL.TextColor3 = Color3.fromRGB(180, 180, 180)
- SL.TextSize = 12
- local B = Instance.new("TextButton")
- B.Parent = F
- B.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
- B.Position = UDim2.new(0.1, 0, 0.55, 0)
- B.Size = UDim2.new(0.8, 0, 0, 45)
- B.Font = Enum.Font.Gotham
- B.Text = "Quiz: OFF"
- B.TextColor3 = Color3.fromRGB(255, 255, 255)
- B.TextSize = 14
- local C2 = Instance.new("UICorner")
- C2.CornerRadius = UDim.new(0, 8)
- C2.Parent = B
- local quizEnabled = false
- local currentQuestion = nil
- local currentSectorIndex = 1
- local usedInCurrentSector = {}
- local connections = {}
- local sectors = {
- {
- N = "HISTORY",
- Q = {
- {Q = "Which long river was vital to ancient Egypt?", A = "nile"},
- {Q = "Who was the first president of the United States?", A = "washington"},
- {Q = "Which ancient empire built the Colosseum?", A = "roman"},
- {Q = "What famous wall in Germany fell down near the end of the eighties?", A = "berlin"}
- }
- },
- {
- N = "GEOGRAPHY",
- Q = {
- {Q = "What is the capital city of Australia?", A = "canberra"},
- {Q = "Which ocean is the deepest on Earth?", A = "pacific"},
- {Q = "What is the largest country by land mass?", A = "russia"},
- {Q = "What country has the capital city named Paris?", A = "france"}
- }
- },
- {
- N = "SCIENCE",
- Q = {
- {Q = "Which element has the atomic symbol Au?", A = "gold"},
- {Q = "Which planet is the hottest in our solar system?", A = "venus"},
- {Q = "What is the closest star to Earth?", A = "sun"},
- {Q = "What force keeps humans pulled down to the ground?", A = "gravity"}
- }
- }
- }
- local function send(txt)
- if T.ChatVersion == Enum.ChatVersion.TextChatService then
- local c = T:FindFirstChild("TextChannels") and T.TextChannels:FindFirstChild("RBXGeneral")
- if c then c:SendAsync(txt) end
- else
- local r = R:FindFirstChild("DefaultChatSystemChatEvents") and R.DefaultChatSystemChatEvents:FindFirstChild("SayMessageRequest")
- if r then r:FireServer(txt, "All") end
- end
- end
- local function hook(p)
- if p == LP then return end
- connections[p] = p.Chatted:Connect(function(m)
- if not quizEnabled or not currentQuestion then return end
- if string.find(string.lower(m), string.lower(currentQuestion.A)) then
- local ans = currentQuestion.A
- currentQuestion = nil
- send("Yes " .. p.Name .. "! The answer was " .. string.upper(ans) .. ".")
- end
- end)
- end
- for _, p in ipairs(P:GetPlayers()) do hook(p) end
- P.PlayerAdded:Connect(hook)
- P.PlayerRemoving:Connect(function(p)
- if connections[p] then
- connections[p]:Disconnect()
- connections[p] = nil
- end
- end)
- B.MouseButton1Click:Connect(function()
- quizEnabled = not quizEnabled
- if quizEnabled then
- B.Text = "Quiz: ON"
- B.BackgroundColor3 = Color3.fromRGB(50, 180, 50)
- else
- B.Text = "Quiz: OFF"
- B.BackgroundColor3 = Color3.fromRGB(220, 50, 50)
- currentQuestion = nil
- SL.Text = "System Idle"
- end
- end)
- task.spawn(function()
- while true do
- task.wait(1)
- if quizEnabled and not currentQuestion then
- local sec = sectors[currentSectorIndex]
- if #usedInCurrentSector >= #sec.Q then
- usedInCurrentSector = {}
- currentSectorIndex = currentSectorIndex + 1
- if currentSectorIndex > #sectors then currentSectorIndex = 1 end
- sec = sectors[currentSectorIndex]
- send("[SYSTEM] Shifting to Sector: " .. sec.N)
- task.wait(3)
- end
- local avail = {}
- for _, q in ipairs(sec.Q) do
- local u = false
- for _, v in ipairs(usedInCurrentSector) do
- if v.Q == q.Q then u = true break end
- end
- if not u then table.insert(avail, q) end
- end
- if #avail > 0 then
- currentQuestion = avail[math.random(1, #avail)]
- table.insert(usedInCurrentSector, currentQuestion)
- SL.Text = sec.N .. " Sector"
- send("[" .. sec.N .. "] QUIZ: " .. currentQuestion.Q)
- local t = 25
- while t > 0 and currentQuestion and quizEnabled do
- task.wait(1)
- t = t - 1
- SL.Text = "Time Left: " .. t .. "s"
- end
- if currentQuestion and quizEnabled then
- send("Time out! The correct answer was: " .. string.upper(currentQuestion.A))
- currentQuestion = nil
- end
- end
- end
- end
- end)
RAW Paste Data
Copied
