Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What does this mean? (Looping aka while true do)

minutesAfterMidnight = 0
while true do
	minutesAfterMidnight = minutesAfterMidnight + 5
	game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
		wait(1)

end

I don't understand this script,mostly after it says while true do

what does it mean by game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(1) ?

and what does minutesAfterMidnight = minutesAfterMidnight + 5 do?

2 comments

0

Edited to fix code formatting

1 answer

Hello. Thanks for coming to scripting helpers!

This script is a simple loop that adds 5 to the current value of the vairable "minutesAfterMidnight".

MinutesAfterMidnight=0 --This is defining the vairable,since you can't reference a NULL/NIL vairable!

while true do --This is a simple example of an infinite loop;this will run forever until BREAK is called.

MinutesAfterMidnight=MinutesAfterMidnight+5 --We are taking the current value of 'MinutesAfterMidnight',and adding 5 to it.

game.Lighting:SetMinutesAfterMidnight(MinutesAfterMidnight) --We are setting the games time to the value of the vairable.

wait(1) --A delay,which slows down the script.

end --The end of the loop

Hope this helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.