Problem with for loop

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to fix this for loop error

  2. What is the issue? The script is throwing an error

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have tried to debug this issue the issue is still an issue

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local TextLabel = script.Parent
local Clock_Time = game.Lighting.ClockTime
local Days = {
	"Monday",
	"Tuesday",
	"wednesday",
	"Thrusday",
	"Friday",
	"Saturday",
	"Sunday"}

--for i, v in ipairs(Days) do
	--print(v)
--end


for i = Days[1], #Days, 1 do
	TextLabel.Text = Days[i]
	if Clock_Time <= 24/2 then
		Days = Days + 1
	else
		
	end
end

Hello, i got a problem where my for loop errors why is this happening?

i = Days[1] is wrong, i has to be a number, so put 1 and it should work.

Use for i v in pairs loops to fiz this problem

Yeah but i want to loop through the whole table and only display one text label from the table at a time once the clock time reaches 12

Maybe try changing this to the code below. You’re starting the loop at a string and not a number. For loops are meant to only be dedicated to numbers.

for i = 1, #Days, 1 do

end