Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get text box to write answer of GUI questions? [closed]

Asked by 5 years ago

I am working on a game which works on finding some things and answering questions like Baldi basics roblox version..where you find books and solve math questions by writing right answers in text box..any way to do it?

0
This is not a request site. WideSteal321 773 — 5y
0
once they have entered the text, do if textbox.Text == your answer then tonyv537 95 — 5y

Closed as Not Constructive by Gey4Jesus69, plasma_node, gitrog, and alphawolvess

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
Vik954 48
5 years ago

When you press the Enter key it gets the text in the input and transforms it in a number. If it isn't the number, the answer is wrong. If it is a number, check if it is equal with the result. if it is, the answer is right. If it isn't, the answer is wrong. This is what I said in a ModuleScript:

local function CheckAnswer(input, answer)
    local printedAnswer = tonumber(input.Text)
    local rightAnswer = false    

    if printedAnswer and printedAnswer == answer then
        rightAnswer = true
    end

    return rightAnswer
end

return CheckAnswer
0
If it dosent work, write "return CheckAnswer()" instead of "return CheckAnswer" Vik954 48 — 5y
Ad