Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

2 comments

0

thanks

0

@LuaScriptingBlox Please mark the answer as accepted

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.