I’m making a verification system for my game to fend off bots.
Heres the script: (The last part where it repeat doesnt work)
local numbers = {1,2,3,4,5,6,7,8,9,0}
local numberNames = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Zero"}
local RandomButton = {1,2,3,4}
local QuestionLabel = script.Parent.QuestionLabel
local CorrectNum = script.Parent.CorrectNum
local t1 = script.Parent.t1
local t2 = script.Parent.t2
local t3 = script.Parent.t3
local t4 = script.Parent.t4
local QuestionLabelAnswer
local Correct
CorrectNum.Value = numberNames[math.random(1,#numberNames)]
QuestionLabel.Text = "Choose number: "..CorrectNum.Value
if CorrectNum.Value == "One" then
QuestionLabelAnswer = 1
elseif CorrectNum.Value == "Two" then
QuestionLabelAnswer = 2
elseif CorrectNum.Value == "Three" then
QuestionLabelAnswer = 3
elseif CorrectNum.Value == "Four" then
QuestionLabelAnswer = 4
elseif CorrectNum.Value == "Five" then
QuestionLabelAnswer = 5
elseif CorrectNum.Value == "Six" then
QuestionLabelAnswer = 6
elseif CorrectNum.Value == "Seven" then
QuestionLabelAnswer = 7
elseif CorrectNum.Value == "Eight" then
QuestionLabelAnswer = 8
elseif CorrectNum.Value == "Nine" then
QuestionLabelAnswer = 9
elseif CorrectNum.Value == "Zero" then
QuestionLabelAnswer = 0
end
Correct = RandomButton[math.random(1,#RandomButton)]
if Correct == 1 then
t1.IsCorrect.Value = true
t1.Number.Text = QuestionLabelAnswer
elseif Correct == 2 then
t2.IsCorrect.Value = true
t2.Number.Text = QuestionLabelAnswer
elseif Correct == 3 then
t3.IsCorrect.Value = true
t3.Number.Text = QuestionLabelAnswer
elseif Correct == 4 then
t4.IsCorrect.Value = true
t4.Number.Text = QuestionLabelAnswer
end
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "t1" or v.Name == "t2" or v.Name == "t3" or v.Name == "t4" then
if v:WaitForChild("IsCorrect").Value ~= true then
if QuestionLabelAnswer ~= v:WaitForChild("Number").Text then
v:WaitForChild("Number").Text = numbers[math.random(1,#numbers)]
if v:WaitForChild("Number").Text == QuestionLabelAnswer then
repeat v:WaitForChild("Number").Text = numbers[math.random(1,#numbers)] until v:WaitForChild("Number").Text ~= QuestionLabelAnswer
print("Retrying...")
end
end
end
end
end