I got bored and decided to create a lua announcement system with the ROBLOX API.
One part is the display code, and the other part is the announcement code.
DISPLAY CODE
while true do
wait(0.2)
if script.Parent.Parent.An.Value == 0 then
script.Parent.An1.Text = "This bus terminates here"
script.Parent.An2.Text = "Bus is on diversion"
script.Parent.Selected.Text = "The destination has changed"
script.Parent.An3.Text = "Driver change"
script.Parent.An4.Text = "Next stop is closed"
script.Parent.An5.Text = "Move Down"
elseif script.Parent.Parent.An.Value == 1 then
script.Parent.An1.Text = "Next stop is closed"
script.Parent.An2.Text = "This bus terminates here"
script.Parent.Selected.Text = "Bus is on diversion"
script.Parent.An5.Text = "Move Down"
script.Parent.An3.Text = "The destination has changed"
script.Parent.An4.Text = "Driver change"
elseif script.Parent.Parent.An.Value == 2 then
script.Parent.An5.Text = "Move Down"
script.Parent.An1.Text = "Driver change"
script.Parent.An2.Text = "Next stop is closed"
script.Parent.Selected.Text = "This bus terminates here"
script.Parent.An3.Text = "Bus is on diversion"
script.Parent.An4.Text = "The destination has changed"
elseif script.Parent.Parent.An.Value == 3 then
script.Parent.An1.Text = "The destination has changed"
script.Parent.An2.Text = "Driver change"
script.Parent.Selected.Text = "Next stop is closed"
script.Parent.An3.Text = "This bus terminates here"
script.Parent.An4.Text = "Bus is on diversion"
script.Parent.An5.Text = "Move Down"
elseif script.Parent.Parent.An.Value == 4 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Move Down"
script.Parent.An3.Text = "Next stop is closed"
script.Parent.An4.Text = "This bus terminates here"
script.Parent.An5.Text = "Driver Change"
elseif script.Parent.Parent.An.Value == 5 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Driver Change"
script.Parent.An3.Text = "Next stop is closed"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 6 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Passenger Safety"
script.Parent.An3.Text = "Driver Change"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 7 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "No Standing On The Upper Deck"
script.Parent.An3.Text = "Driver Change"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 8 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Ticket Inspectors"
script.Parent.An3.Text = "Driver Change"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 9 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Please leave the bus"
script.Parent.An3.Text = "Driver Change"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 10 then
script.Parent.An1.Text = "Bus is on diversion"
script.Parent.An2.Text = "The destination has changed"
script.Parent.Selected.Text = "Regulating Service"
script.Parent.An3.Text = "Driver Change"
script.Parent.An4.Text = "This bus terminates here"
elseif script.Parent.Parent.An.Value == 11 then
script.Parent.Parent.An.Value = 0
elseif script.Parent.Parent.An.Value == -1 then
script.Parent.Parent.An.Value = 11
end
end
ANNOUNCEMENT DISPLAY CODE
c = script.Parent.Parent.Parent:GetChildren()
function onClicked()
if script.Parent.Parent.iBusControlSystem.iBus.Enabled == true then
if script.Parent.Parent.iBusControlSystem.An.Value == 0 then
script.Parent.Parent.iBusControlSystem.DestinationChange:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "The destination has changed. Listen for more info"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "The destination of this bus has changed"
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 1 then
script.Parent.Parent.iBusControlSystem.BusOnDiversion:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "This bus is now on Diversion. Please listen for more info"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "This bus is on Diversion"
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 2 then
script.Parent.Parent.iBusControlSystem.Terminate:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "This bus terminates here, take your items with you"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Bus Terminates Here"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "This bus terminates here, Please take all your belongings with you."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 3 then
script.Parent.Parent.iBusControlSystem.NextStopClosed:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "The next bus stop is closed"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "The next bus stop is closed"
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 4 then
script.Parent.Parent.iBusControlSystem.MoveDown:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Please move down inside the bus"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Move Down Inside The Bus"
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 5 then
script.Parent.Parent.iBusControlSystem.DriverChange:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Bus will wait here while drivers are changed"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Wait a short time for change of drivers."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 6 then
script.Parent.Parent.iBusControlSystem.PassengerSafety:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "For safety, drivers cannot open doors between stops"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "In the intrest of passenger safety drivers cannot open doors"
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 7 then
script.Parent.Parent.iBusControlSystem.Standing:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "No Standing On The Upper Deck"
wait(1.91)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Or Stairs Please"
wait(2.49)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Wait a short time for change of drivers."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 8 then
script.Parent.Parent.iBusControlSystem.Tickets:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Ticket inspectors operate on this bus"
wait(2.65)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Pay as you go users are reminded to"
wait(2)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "touch in your oyster card when you board"
wait(5.84)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Wait a short time for change of drivers."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 9 then
script.Parent.Parent.iBusControlSystem.LeaveBus:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Please leave the bus"
wait(1.21)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "And board the next avaliable bus"
wait(3)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Wait a short time for change of drivers."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
elseif script.Parent.Parent.iBusControlSystem.An.Value == 10 then
script.Parent.Parent.iBusControlSystem.Regulate:Play()
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "This bus is being held here"
wait(2)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "in order to help regulate the service"
wait(7)
script.Parent.Parent.Interface.SurfaceGui.Frame.Announcement.Text = "Welcome aboard"
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = true
c[i].SurfaceGui.iBus.Text = "Wait a short time for change of drivers."
end
end
wait(10)
for i=1, #c do
if c[i].Name == "iBusPassenger" then
c[i].SurfaceGui.iBus.Visible = false
c[i].SurfaceGui.iBus.Text = "Label"
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
What do you think?