Why does my script not work?

im trying to make a simple sign that instead of a textlabel has a textbox in the surfacegui.
why a textbox you might ask?
well i want to use a textbox so the player can answer the question thats written on the placeholder text.
but when i type the correct answer nothing happens.
i worked with guis before and thats how i did it so it not working suprised me.
script:

local Box = script.Parent
local Quiz = "12"

Box.FocusLost:Connect(function(enter)
	if enter then
		local Answer = Box.Text
		print(Answer)--doesn't even print the answer...
		if Answer  == Quiz  then
			Box.Parent.Parent.Parent:SetAttribute("Completed",true)
			Instance.new("Sparkles",Box.Parent.Parent.Parent).SparkleColor = Color3.new(0,1,0)
		end
	end
end)

If it isn’t already in the StarterGui, you have to put your SurfaceGui inside the StarterGui, then there is a “Adornee” propertie in the SurfaceGui, click it and select the part/mesh of your sign, where you want it to be.
From what i know, Buttons and TextBox are not working when being in workspace.
Also make sure to do it in a local script, as the Text of the TextBox can’t be detected on Server Side and local script also doesn’t work in the workspace.

It’s a localscript?
Are you accessing from startergui? (the script)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.