TextLabels showing blank when edited with a script


I have just been working on a script that basically prints a ticket (clones a tool from ServerStorage to workspace).

However it doesn’t fully work the way I intended it to, I wanted it so that staff members could add their username aswell as the passengers username but sadly this doesn’t work. Instead the text on the ticket just gets deleted and stays blank what makes this all worse is the entire script works fine and no errors show in the console so I have no idea what to change or how to fix it after almost 2 hours of trying.

Appreciate any help I can get!

Here is the script I am using

ticket = game.ServerStorage.TicketStorage.Terminal1.Ticket.Handle

function OnClicked() 
	ticket.SurfaceGui.StaffName.Text = script.Parent.Parent.IssuedTxt.IssuedInput.Text
	ticket.SurfaceGui.UsernameOut.Text = script.Parent.Parent.Usertxt.UsernameInput.Text
	script.Parent.Parent.Parent.Parent.DSRCheckin.Enabled = false
	game.ServerStorage.TicketStorage.Terminal1.Ticket:Clone().Parent = workspace


Feel free to download the RBXL file with everything on it + a working example
BrokenTicketSystem.rbxl (43.5 KB)

1 Like

You can’t change properties of UI with a Script you will need to use a LocalScript.

Try making the text event be fired from the client with a remote event and make it check if the text is the same as their username / display name so that exploiters can’t abuse it.

You can actually change the properties of a UI with a Script it is very helpful sometimes. Your actual problem is that you are trying to get the properties of a UI of a local player. Lets take the line:


Here you are trying to get the text from a textbox that the client has typed text into. But the text that the client has typed into that textbox does not automatically replicate to the server as this would be dangerous.

One way you can get around this is to use a remote event so when the player clicks the “Print” button it will send a request to the server to then print the ticket.