Heres the script:
while true do
local timeToNextSpawn = 30
repeat until timeToNextSpawn == 0
game.StarterGui.IGHUD.TimeTillNextSpawn.TextTransparency = 0
game.StarterGui.IGHUD.TimeTillNextSpawn.BackgroundTransparency = 0
local TTNSDisplay = ("The next train will spawn in") timeToNextSpawn ("seconds.")
print(TTNSDisplay)
game.StarterGui.IGHUD.TimeTillNextSpawn.Text = TTNSDisplay
local timeToNextSpawn = timeToNextSpawn - 1
end

2 comments
Could you maybe tell us what the error actually is? Would be quite nice of you.
the variable
timeToNextSpawnis never 0 so your script don't works