What do I want to achieve? I would like to understand how to successfully code a repeat wait() for an item in a table.
What is the issue? The repeat wait() on the second to last line is not working.
I tried looking on Youtube but couldn’t find any tutorials that focused on my specific problem. I also looked through the DevForum and still found nothing.
The ‘Times’ Table consists of texts for a TextLabel in the StarterGui. The repeat wait() will be used to change the fog for nighttime and such. The code is in a script inside the ServerScriptService.
local Times = {
"6:00",
"6:30",
"7:00",
"7:30",
"8:00",
"8:30",
"9:00",
"9:30",
"10:00",
"10:30",
"11:00",
"11:30",
"12:00",
"12:30",
"1:00",
"1:30",
"2:00",
"2:30",
"3:00",
"3:30",
"4:00",
"4:30",
"5:00",
"5:30",
"6:00",
"6:30",
"7:00",
"7:30",
"8:00",
"8:30",
"9:00",
"9:30",
"10:00",
"10:30",
"11:00",
"11:30"
}
for i, v in ipairs(Times) do
print(i)
print(v)
wait(2)
TimeDialogue:FireAllClients(v)
end
--
repeat wait() until Times(i) == 5
game.Lighting.FogEnd = 15