I have been making a destination board for a bus. When the player sits in the drivers seat, a GUI pops up which allows the player to edit the route number and destination on the destination board using a text box in the PlayerGui. Once the player has finished entering the route number and destination, they hit a text button which is meant to apply the text the player has entered in the text box onto the destination board on the bus.
The issue is that when the player hits the button to apply the text they’ve entered onto the destination board, the destination board is updated only for the driver
To fix this I added a remote event to the destination board so the board would be updated, however this presented another issue. When I hit the button to update the board, the board would stay blank and wouldn’t show the updated text. I believe this is because the server doesn’t recognise that the text in the PlayerGui has been updated
This is the GUI in the Explorer
This is the Destination Board in the Explorer
This is what happens when I try updating the board on the bus:
This is the code for the Gui:
local car = script.Parent.Parent.Parent.Car.Value
local board = car.Body.DestinationAndRoute
script.Parent.TextButton.MouseButton1Click:Connect(function()
script.Parent.Route:ReleaseFocus()
script.Parent.Destination:ReleaseFocus()
script.Parent.TextButton.Text = 'Applying Changes...'
script.Parent.Configuration.Destination.Value = script.Parent.Destination.Text
print(script.Parent.Configuration.Destination.Value)
script.Parent.Configuration.Route.Value = script.Parent.Route.Text
print(script.Parent.Configuration.Route.Value)
wait(3)
board.UpdateBoard:FireServer()
script.Parent.TextButton.Text = 'Board Updated'
wait(1)
script.Parent.TextButton.Text = 'Apply'
end)
This is the script for the remote event
board = script.Parent
script.Parent.UpdateBoard.OnServerEvent:Connect(function(player)
local gui = player.PlayerGui['A-Chassis Interface'].BusControls.DestinationBoard
wait(2)
print(gui.Configuration.Route.Value)
board.DestinationBoard.Screen.SurfaceGui.RouteNumber.Text = gui.Configuration.Route.Value
board.DestinationBoardTwo.Screen.SurfaceGui.RouteNumber.Text = gui.Configuration.Route.Value
board.Route.Screen.SurfaceGui.Route.Text = gui.Configuration.Route.Value
print(gui.Configuration.Destination.Value)
board.DestinationBoard.Screen.SurfaceGui.Destination.Text = gui.Configuration.Destination.Value
board.DestinationBoardTwo.Screen.SurfaceGui.Destination.Text = gui.Configuration.Destination.Value
end)