How to use textboxes on a surfacegui?

So I have made a information screen for an airport, however i’m trying to get some values in it updated by inputting those values in a textbox in a different screengui.

It does work if u update from the server, but as a client it doesnt. I have thought of using remote events, but it didn’t work, I just didn’t know how to do it since there were going to be many of these screens that will need to display different values.

The text does show up on the textbox in client mode, but it just doesn’t send it to the other screen like in server mode.

What alternative could I use.

This is code I used in the script sending the value (localscript)

while wait(1)do
	local newval = script.Parent.Parent.Parent.Parent.Parent.Parent.InfoTV.screen.SurfaceGui.System.Delay.Value

And the serverscript recieving it and editing the value

	script.Parent.Parent.InfoTV.screen.SurfaceGui.System.Delay.Value = newval

I’m not really sure where the problem is, but I am grateful for any help.

1 Like

If I’m interpreting what you are trying to do correctly, you should be using FireClient here, not FireServer.

Whenever you change the value or what have you on the server side, use a RemoteEvent to update the values on the UI locally for every client. Specifically, you can call FireAllClients to update the UI for every player in-game.

Here’s a mock of what that would look like:

-- Server
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

while task.wait(1) do
  -- The "data" variable here is whatever information you are trying to update on the client
-- Client
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local UI = ...

  -- Again, the "UI" variable is the TextBox you want to change
  UI.Text = data

If you’re wanting to change the value for all clients when a client updates a value locally, that’s a bit more tricky.

You’ll have to use a RemoteEvent (or a RemoteFunction to check if the value change is possible) from the client to the server to request the change be made, and then use the above principle (ignoring the sending user, as their data is already changed locally) to replicate that change for all other users.

I don’t think it would work. This script only updates the stringvalue in the settings folder of the system
There are other serverscripts that actually update the text from the stringvalue.