I'm building an airport with a friend, and I want to make a single main script that handles all the functions that the airport does.
There is a SurfaceGui in the airport that shows departure times (in seconds). I managed to make a NumberValue stored in a Folder count down, but I need to make it so the time shows on the screen as well.
My friend somehow did this without using tostring() for the NumberValue, but he used multiple scripts, which I want to avoid, since it's very unorganized.
Below I'll post my script and then my friends' scripts. These are normal Scripts placed in Workspace.
My script:
local airport = game.Workspace.Airport
local booths = game.Workspace.Airport.Booths
local screen = game.Workspace.Airport.AirportTV
local screen2 = game.Workspace.Airport.AirportTV2
local times = game.Workspace.Airport.DepartureTimes
-- air canada departure times
while times.AirCanada.Value > -1 do
wait (1)
times.AirCanada.Value = times.AirCanada.Value - 1
if times.AirCanada.Value == 0 then
times.AirCanada.Value = 120
end
end
game.Workspace.Airport.DepartureTimes.AirCanada.Changed:connect(function()-- numbervalue
local val = game.Workspace.Airport.DepartureTimes.AirCanada
local label = game.Workspace.Airport.AirportTV.TVScreen.SurfaceGui.AirCanada.Arrival
label.Text = tostring(val.Value)
end)
Friend's scripts
--script 1
while wait(1) do
script.Parent.Value = script.Parent.Value - 1
if script.Parent.Value == -1 then
script.Parent.Value = 120
end
end
--script 2
while wait() do
script.Parent.Text = script.Parent.Time.Value
end
My friend has a habit of making scripts "while wait() do" -_-

2 comments
Maybe use your friends script, If it works, then try using it, if it causes lag, then I see why you want only one script
Ok. So try putting your event connection before the while loop.