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

Is there a way to make the night longer than the day?

Well I am making a game, and I made a script for a cycle but I don't know how to make the night longer than the day in the game. I am trying to expand the time of the night and reduce the time of the day. I need help with it, please. I made a script for the cycle as well, but all the cycle has the same time for the day and the night and I do not know how to increase the time of the night.

4 comments

0

If you want to keep things simple, simply check if the time of the day is at the certain night time and increment the value, with a small value if the condition is true. I doubt it would look good but this is the simplest way to achieve it without a lot of work.

0

Thanks for your help, I made a cycle script but as I said I want to increase just the night and not the day. I can show the script: while wait(0.3) do game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight(7)+1) end

0

No. I meant that if the time of the night is, let's say, around 7:00 p.m, it is going to increment the time of the day by 0.5, as opposed to a typical 1. Once it reaches 7:00 a.m, it's going to revert back to the increment value of 1. Let me know if you need help making it!

0

What game is it your making?

1 answer

Well, you could just do something like this!

local lighting = game:GetService("Lighting")--This just makes a variable for Lighting
while true do
	lighting.ClockTime = lighting.ClockTime + 1--Increases the time
	if lighting.ClockTime > 22 or lighting.ClockTime < 6 then--This if statement checks if it's night or day; before 6:00am and after 10:00pm
		wait(2)--Amount of time for night before increasing time, noticably bigger!
	else
		wait(0.5)--Amount of time for day before increasing time
	end
end

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