Hi Roblox developers! ![]()
I am excited to share Question Assignment, a secure, server-based module for creating and managing unexploitable quizzes/applications. This system is ideal for trainee assessments, question-based tests, and any in-game quiz where integrity and security is crucial.
Features
- Dynamic Question Assignment: Randomly selects questions from a predefined pool.
- Answer Shuffling: Shuffles answer options for each question while maintaining the correct answer index.
- Server-Side Player Tracking: Prevents client-side tampering with responses.
- Answer Validation: Ensures responses are submitted in order and are legitimate.
- Strike Thresholds: Tracks incorrect answers and optionally enforces limits via signal.
- Spoof Detection: Fires a signal when suspicious activity is detected, allowing you to respond (e.g., log, or kick) without automatically taking action.
- Client-Safe Question Delivery: Optionally hides correct answers from clients.
Usage Example (Luau)
local questionAssignment = require(path.to.module)
-- Handle players attempting to exploit the system
questionAssignment.onSpoofed:Connect(function(player, reason)
player:Kick(("Application denied: %s\nYour actions have been reported."):format(reason or "Exploiting"))
end)
-- Assign questions to a player (clientSafe hides correct answers)
local questions = questionAssignment.assignQuestionsToPlayer(player, true)
-- Record responses
local result = questionAssignment.addResponse(player, 1, "Answer Text")
local isCorrect = questionAssignment.isCorrectAnswer(player, 1, "Answer Text")
-- Grade application after last question
local correct, incorrect = questionAssignment.gradeApplication(player)
Question Guide
Each entry in this table represents one multiple-choice question. To add more, copy an existing block and edit the fields below:
Fields:
questionText(string) – The question being asked.answerOptions(array) – A list of possible answers. Each must have:{ responseText = "Answer text here" }correctIndex(number) – The index of the correct answer (1-based).
Example Entry:
{
questionText = "What is 2 + 2?",
answerOptions = {
{ responseText = "3" },
{ responseText = "4" },
{ responseText = "5" }
},
correctIndex = 2
}
Notes:
- Keep
answerOptionsin consistent formatting. - Always ensure
correctIndexpoints to the correct answer. - Use
-- ncomments to keep track of numbering if desired.
Template for adding new questions:
return {
{ -- 1
questionText = "Write your question here",
answerOptions = {
{ responseText = "Option A" },
{ responseText = "Option B" },
{ responseText = "Option C" },
{ responseText = "Option D" },
},
correctIndex = 1 -- Change to whichever option is correct
},
-- Copy & paste more entries below this line
}
Getting Started
- Import the module into your game using the Roblox model:
Question Assignment Module - Set up RemoteFunctions or RemoteEvents for
FetchQuestions,AnswerQuestion, andRestartInterview. - Customize
Configuration.luauto adjust total questions and strike limits. - Add your question pool in
Entries.luau.
Recommendations
- Always use
clientSafe = truewhen sending questions to clients. - Wrap assignment operations in
pcallif you are a defensive programmer and want to prevent runtime errors in case of an exploiter. - Log all spoofed events and strikes to maintain an audit trail.
- Clear player data when restarting applications to prevent duplicates.
- Use multiple question entries to maximize randomization and prevent repeated patterns.
I hope this module helps you build secure, reliable quizzes and applications in your games!
Feedback, feature requests, or improvements are welcome. ![]()