.FocusLost() not working

I made a code system in my game, and everything worked, but now just randomly, it stopped working. I checked my script errors by printing something when the FocusLost happens, and it did not print, so I’m guessing it’s the FocusLost part not working. If anyone can find what’s wrong with my script, I would really appreciate it! Thanks.

Script:

typer.FocusLost:Connect(function(entered, inputThatCausedFocusLoss)
	if typer.Text == codes[1] then
		if outputs:InvokeServer({cash}, 100, codes[1]) == false then
			typer.TextEditable = false
			typer.Text = "Code Redeemed!"
			ding:Play()
			wait(1)
			typer.TextEditable = true
			
		elseif outputs:InvokeServer({cash}, 100, codes[1]) == true then
			typer.TextEditable = false
			typer.Text = "Code was redeemed already."
			err:Play()
			wait(1)
			typer.TextEditable = true
		end
		
		
		
	elseif typer.Text == codes[2] then
		if outputs:InvokeServer({cash}, 15, codes[2]) == false then
			typer.TextEditable = false
			typer.Text = "Code Redeemed!"
			ding:Play()
			wait(1)
			typer.TextEditable = true
			
		elseif outputs:InvokeServer({cash}, 15, codes[2]) == true then
			typer.TextEditable = true
			typer.Text = "Code was redeemed already."
			err:Play()
			wait(1)
			typer.TextEditable = true
			
		end
		
		
		
		
	elseif typer.Text == codes[3] then
		if outputs:InvokeServer({cash}, 30, codes[3]) == false then
			print("br")
			typer.TextEditable = false
			typer.Text = "Code Redeemed!"
			ding:Play()
			wait(1)
			typer.TextEditable = true

		elseif outputs:InvokeServer({cash}, 30, codes[3]) == true then
			typer.TextEditable = true
			typer.Text = "Code was redeemed already."
			err:Play()
			wait(1)
			typer.TextEditable = true

		end		
		
		
		
		
	else
		typer.TextEditable = true
		typer.Text = "Expired or invalid."
		err:Play()
		wait(1)
		typer.TextEditable = true
	end

end)

I Have Tested your code, it seems to register focus loss, Could you please send the entire script so i can review it and check for other errors that could be freezing the thread before it reaches that code snipped?