Day Night Cycle [ Smooth ]

You can, it’s on the time_Increment and time_Wait documentations.

Simply do

Module_Time.time_Increment = 1 -- 1 hour per loop
1 Like

i mean as in the ability to make the day last longer than the night

Thank you, if you have any suggestions or feature requests, feel free to request them.

I created this as my game required it. This is the less complex and beta version.

Ah, I could fork it for you. Do tell me what you consider night ( example : after 8 PM to 0 AM)

1 Like

i consider night from 9:30pm til 6am

0.5 would be 30 mins and .25 = 15 mins etc?

It uses ClockTime to skip extensive calculations and formatting so it may be off by a little if you use low decimal values. It’ll still work.

I’ll have one out for you or add it in an eventual second version as it’d have additional conditions and behaviour. If I find time I’ll either post it here as a forked version or private message you it.

1 Like

thank you!!

1 Like

What would be the math behind it then?

can time be pauses and played locally, dont want to force everyone to have the cycle, but have it as an option.

Wouldn’t creating excessive amount of tween can cause memory leak? Don’t get me wrong, I like this, but it can be optimized way more.

How about a stop time feature? -----------

The GC should be collecting them once they’re overridden, though I could add in a Tween:Destroy().

To sum up the post below from a fellow devforum member: Tweens, like any other Instances, will be garbage collected when no longer pointed to.

I was thinking about this as well, sure I’ll add it in.

Could you describe it further @Wertyhappy27? If you mean enable/disable the script at will, you could do that with a TextButton.

TextButton.Activated:Connect(function()

LocalScript.Enabled = not LocalScript.Enabled

end

The maths? We got a mathematician! I personally tried to make this lean away from extensive maths so

  • A) Less changes have to be Replicated

  • B) User friendly

But I’ll probably shift to TimeOfDay.

Maths behind it:
Simply find out what is the % of minutes to an hour.

Divide the number of minutes by 60 , which is the number of minutes in an hour. For example, convert 14.75 minutes to a percentage by dividing 14.75 by 60, which equals about 0.246, or 24.6 percent." - Google Search

Or alternatively search up “what is 70% of one hour” online. Input answer to attain the corresponding time.

Just to be clear, if a player joined their time and tween would automatically be synced, correct?

Yes, all players will always follow time in sync, regardless of when they join or leave.

Post Update

Day Night Cycle asset will not be updated. This is a simplified asset dump and it has cleared the conceptual phase.

Distribution while acquiring currency resources is not allowed. Crediting me is not required. You may modify the code to your liking.

An alright module, but I dislike how it sets the time to zero initially. So i had to make some changes.