Loop Doesn't Run

Hello!

So I just spent the last hour creating a script and when I was testing it out, the loop print wasn’t printing. It was working before, but now for some reason it isn’t. Everything is defined and indented properly. The code follows:

while true do
print(“Looped”)
wait(0.1)
if time >= “18” and time <= “18.7” and daynight == “0” then
Night:Play()
print(“Tweened”)
daynight = 1
wait(0.1)
end
if time >= “6.1” and time <= “6.1” and daynight == “1” then
Day:Play()
print"Went back"
daynight = 0
wait(0.1)
end
end

Any help will be appreciated.

R3M1X

Is the script disabled, is it not printing? Is there some code before the loop that is blocking the thread?

The script is not disabled and the code before shouldn’t be blocking anything. The script has prints that print every time a command is started. It follows:

local terrain = game.Workspace.Terrain

local time = game.Lighting.ClockTime

local daynight = script.Parent.DayNight.Value

local colorValue = Instance.new(“Color3Value”)

colorValue.Value = terrain:GetMaterialColor(“Grass”)

colorValue.Parent = script.Parent

colorValue:GetPropertyChangedSignal(91, 122, 380)

colorValue:GetPropertyChangedSignal(“Value”):connect(function()

terrain:SetMaterialColor(“Grass”, colorValue.Value)

end)

local tweenInfo = TweenInfo.new(60, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

local Night = game:GetService(“TweenService”):Create(colorValue, tweenInfo, {Value = Color3.fromRGB(91, 122, 380 )})

local Day = game:GetService(“TweenService”):Create(colorValue, tweenInfo, {Value = Color3.fromRGB(110, 148, 70)})

R3M1X

Please format your code using the forms formatter.

This part of the code isn’t indented in any way.

R3M1X

print("Looped")
wait(0.1)
if time >= "18" and time <= "18.7" and daynight == "0" then
	Night:Play()
	print("Tweened")
	daynight = 1
	wait(0.1)
end

if time >= "6.1" and time <= "6.1" and daynight == "1" then 
	Day:Play()
	print"Went back"
	daynight = 0
	wait(0.1)
end

end

This doesn’t include the while true do, keep that in mind (for the sake of it not working when I was copy/pasting it)

R3M1X