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?
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()
.