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

How do I see what a player types in a textbox and see if its correct?

Asked by 4 years ago

So i'm making this game were there is a pyramid and you have to put a code into a text box and if you get the code correct you may pass. The only problem i have is seeing what the player typed in the text box and see if its correct.Here is my script im looking for a better way


if script.Parent.Text == "2020" then print("yeayy") end

2 answers

Log in to vote
0
Answered by 4 years ago
script.Parent.Changed:Connect(function (text) -- this will trigger the function whenever the text is edited

    if text == "2020" then

        --Code goes gere

    end

end)
0
thanks LuaScriptingBlox 0 — 4y
0
@LuaScriptingBlox Please mark the answer as accepted Leamir 3138 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

This is a better solution if you are finding out whether the player has stopped typing and unfocused the box.

script.Parent.FocusLost:Connect(function() -- When the focus is lost, fire this
    if script.Parent.Text == "text" -- If the input is correct
        -- Code here
    end
end)

Answer this question