Answered by
5 years ago Edited 5 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:
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
3 | script.Parent.Parent.Parent.InfoGUI.InfoBoard.Aircraft.Aircrafttype.Text = script.Parent.Text |
4 | 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:
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
3 | ReplicatedStorage:WaitForChild( "ChangeText" ).OnServerEvent:Connect( function (player, text, textToSet) |
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()
.