Text won't change

I am trying to make text change from a GUI. My issue is well… the text won’t change.
I’ve looked over the code a bunch of times and looked stuff up but to no avail.

local Line1A = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOA.Line1.SurfaceGui:FindFirstChild("TextLabel")
local Line2A  = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOA.Line2.SurfaceGui:FindFirstChild("TextLabel")
local Line3A  = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOA.Line3.SurfaceGui:FindFirstChild("TextLabel")
local Line1B  = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOB.Line1.SurfaceGui:FindFirstChild("TextLabel")
local Line2B  = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOB.Line2.SurfaceGui:FindFirstChild("TextLabel")
local Line3B  = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Animations.Destinations.DTSOB.Line3.SurfaceGui:FindFirstChild("TextLabel")

script.Parent.MouseButton1Down:Connect(function()
if script.Parent.Parent.PISCode.Text == "00000" then
        Line1A.Text = ""
		Line1B.Text = ""
		Line2A.Text = ""
		Line2B.Text = ""
		Line3A.Text = ""
		Line3B.Text = ""
	elseif script.Parent.Parent.PISCode.Text == "00202" then
		Line1A.Text = ""
		Line1B.Text = ""
		Line2A.Text = ""
		Line2B.Text = ""
		Line3A.Text = "Audley End"
		Line3B.Text = "Audley End"
	elseif script.Parent.Parent.PISCode.Text == "00203" then
		Line1A.Text = ""
		Line1B.Text = ""
		Line2A.Text = ""
		Line2B.Text = ""
		Line3A.Text = "Baldock"
		Line3B.Text = "Baldock"
	elseif script.Parent.Parent.PISCode.Text == "00204" then
		Line1A.Text = ""
		Line1B.Text = ""
		Line2A.Text = ""
		Line2B.Text = ""
		Line3A.Text= "Bedford"
		Line3B.Text= "Bedford"
	elseif script.Parent.Parent.PISCode.Text == "00205" then
		Line1A.Text = "Bishop's"
		Line1B.Text = "Stortford"
		Line2A.Text = "Bishop's"
		Line2B.Text = "Stortford"
		Line3A.Text = ""
		Line3B.Text = ""
end
end)

All help appreciated

1 Like

Did you verify that script.Parent.Parent.PISCode.Text is really equal to "00000", "00202", etc?

Yes, I did. I have tried everything and the text simply wont change

Is Line1A , Line1B etc… found? Try to print there text value. And you can make a smaller code by creating a function and passing parameters to it to change values of your five variables

Line1A, Line1B etc is found. I’ve printed them and they return “TextLabel” which is good.

MouseButton2Down is a different event, I don’t really see how it’s gonna fix the issue.

Yes i thought it was a new method more performant than MouseButton1Down

1 Like

Just put your GUI in StarterGui and set it’s adornee to the part you want to. If it still don’t work, maybe the script is the real problem.

But it would be easy to fix too, but try this first before doing anything and ruining your actual script.

When you’re trying to update the TextLabel, To the current new information. You need to call the changed function event on the TextLabel that is being updated.