So I am trying to make a question Gui where admins can write a question and everyone on the server answers the question.
However, when I set up the Gui, there is a script that allows you to submit the question. This submit button does not work and I am not sure how to fix it.
I have tried to find a fix but I could not figure it out.
Here is a screenshot of the Gui, and when I press submit it should print the question and answer choices in the output. However, it prints other stuff that I do not want it to.
For example, when I press submit on this it should send the question and answer choices to the server from a remote event.
In the output, it should print the question, answer a, b, c, and d in that order. But this is the output.
Script on the submit button:
local db = true
local rs = game:GetService("ReplicatedStorage")
script.Parent.MouseButton1Click:Connect(function()
if db == true then
if script.Parent.Parent.QuestionInput.Text ~= "" then
local Question = script.Parent.Parent.QuestionInput.Text
local AnswerA = script.Parent.Parent.AnswerA.Text
local AnswerB = script.Parent.Parent.AnswerB.Text
local AnswerC = script.Parent.Parent.AnswerC.Text
local AnswerD = script.Parent.Parent.AnswerD.Text
rs.Remotes.QuestionR:FireServer(Question, AnswerA, AnswerB, AnswerC, AnswerD)
elseif script.Parent.Parent.QuestionInput.Text == "" then
db = false
script.Parent.Text = "Question is empty!"
wait(2)
script.Parent.Text = "Submit"
db = true
end
end
end)
Script with the remote event:
local rs = game:GetService("ReplicatedStorage")
rs.Remotes.QuestionR.OnServerEvent:Connect(function(Question, AnswerA, AnswerB, AnswerC, AnswerD)
print(Question)
print(AnswerA)
print(AnswerB)
print(AnswerC)
print(AnswerD)
end)
If anyone has a fix, please let me know! Thank you.