TextBox doesn't detect a numeric code imput

Hello, i’m still new at scripting but already trying some things. I’m making a system so if a player types in a TextBox a certain numeric code and press a confirmation button, some TextLabels update their text. The problem is that the text doesn’t update at all. I used some prints to detect the problem in the output, and I found that the confirmation button is detected, but all the things inside the “if” don’t work.
I can’t figure out what is the problem, here it is the complete setup:

And here is the raw code:

local destino = script.Parent.Parent.Destino.Value
local boton = script.Parent.Parent.Confirmacion
--componentes asfa
local pantalla1 = script.Parent.Parent.Pantalla.Linea1.Text
local pantalla2 = script.Parent.Parent.Pantalla.Linea2.Text
local CodigoMostoles = script.CodigoMostoles.Value
local CodigoFuenlabrada = script.CodigoFuenlabrada.Value
local CodigoHumanes = script.CodigoHumanes.Value
local CodigoAtocha = script.CodigoAtocha.Value
local CodigoSinServicio = script.CodigoSinServicio.Value
local CodigoEspecial = script.CodigoEspecial.Value


	if script.Parent.Text == CodigoMostoles then
		destino = "M. EL SOTO"
		pantalla1 = "CH: 66  TR: "..CodigoMostoles
		pantalla2 = "Destino: M. EL SOTO"
	elseif script.Parent.Text == CodigoFuenlabrada then
		destino = "FUENLABRADA"
		pantalla1 = "CH: 66  TR: "..CodigoFuenlabrada
		pantalla2 = "Destino: FUENLABRADA"
	elseif script.Parent.Text == CodigoHumanes then
		destino = "HUMANES"
		pantalla1 = "CH: 66  TR: "..CodigoHumanes
		pantalla2 = "Destino: HUMANES"
	elseif script.Parent.Text == CodigoAtocha then
		destino = "ATOCHA"
		pantalla1 = "CH: 66  TR: "..CodigoAtocha
		pantalla2 = "Destino: ATOCHA"
	elseif script.Parent.Text == CodigoSinServicio then
		destino = "SIN SERVICIO"
		pantalla1 = "CH: 66  TR: "..CodigoSinServicio
		pantalla2 = "Destino: "
	elseif script.Parent.Text == CodigoEspecial then
		destino = "LIMONES"
		pantalla1 = "CH: 66  TR: "..CodigoEspecial
		pantalla2 = "EL EASTER-EGG XD"
		destino = ""
		pantalla1 = "CH: 66  TR: "
		pantalla2 = "Pantalla Apagada"

P.D.: All the numeric codes are stored in the StringValues, I tried with NumberValues but they don’t work.

1 Like

Try setting the Text property of your pantalla texts directly.

Like so:

pantalla1.Text = "Blah"

What’s happening here is that you’re passing the value of the Text property into your variables, so when you write to those variables you’re writing to the variable itself and not the Text property; as it passes by value, not an actual reference pointer to the property itself.

I hope this helps!

1 Like

Thank you very much, now works nicely!

1 Like