Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make the text in a textbox change the text of something else?

Asked by 4 years ago

I am making an IFE system and there is an Info panel where it displays details about the flight. The problem is, I have an admin panel where you change that info, but I cant figure out how to make a script to change the text.

What I am trying to do is set the TextLabel of the InfoBoard to whatever is inputted in the TextBox that's in the admin config.

I tried something like this:

script.Parent.Parent.Parent.InfoGUI.InfoBoard.Aircraft.Aircrafttype.Text = script.Parent.Text""

But it worked to no avail. Any help?

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Okay. First, insert a RemoteEvent into ReplicatedStorage and name it ChangeText. Next, insert a ServerScript into ServerScriptService. Leave it blank for now. Now edit the LocalScript and change it to this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

script.Parent.Parent.Parent.InfoGUI.InfoBoard.Aircraft.Aircrafttype.Text = script.Parent.Text
ReplicatedStorage:WaitForChild("ChangeText"):FireServer(script.Parent.Text, script.Parent.Parent.Parent.InfoGUI.InfoBoard.Aircraft.Aircrafttype)

This fires the RemoteEvent in ReplicatedStorage.

Now set the text of the ServerScript to this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

ReplicatedStorage:WaitForChild("ChangeText").OnServerEvent:Connect(function(player, text, textToSet)
    textToSet.Text = text
end)

This will set the text to the text of script.Parent.

Note: The LocalSscript will instantly run and fire the RemoteEvent. If you don't want this to happen, try putting the LocalScript code inside an event. For example, ClickDetetcor.MouseClick:Connect(function().

1
Hmm. It seems we are going in the right direction but its not working. Whenever I type in something to the box, the Text property stays blank, but the info board is also blank. TotalElevation 45 — 4y
0
Must be because of the client not effecting the server, therefore the script won't work. I think you have to use a RemoteEvent. youtubemasterWOW 2741 — 4y
0
Im sorry, but I am not too familliar with RemoteEvents. Could you explain where to do it? TotalElevation 45 — 4y
0
I will edit the post, hold on. youtubemasterWOW 2741 — 4y
View all comments (6 more)
0
Okay, I have finished editing. youtubemasterWOW 2741 — 4y
1
Thank you but it doesn't seem to work. I have read it and followed all of your steps. TotalElevation 45 — 4y
0
Then I do not know what is happening, so I do not think I can fix it. Sorry. youtubemasterWOW 2741 — 4y
0
Are there any errors happening? youtubemasterWOW 2741 — 4y
1
No errors come up on the output. TotalElevation 45 — 4y
0
Well, I don't know what's happening so I am afraid I cannot help you. youtubemasterWOW 2741 — 4y
Ad

Answer this question