CleanTime - The Time Module

CleanTime

The Time Module by Swinsor

Information

What is CleanTime?

CleanTime is a 100% free and opensource module to make your timers look nicer. This was a quickly made system, so don’t expect it to be packed with features.

Instead of having it say 122 seconds, it’d say:
2 minutes, 2 seconds.

You can customise what appears before the timer and after the timer, and choose to have it so it shows all hours, minutes and seconds, or just the ones that are relevant (no zeros).

If you have a basic knowlege of coding, you can also change when it runs! EG:
The start of a minigame. (It is by default running on startup.)

Setup

  1. Go ahead and grab the model here!
  2. Place it inside of your game, preferably inside the GUI.
  3. Change to how you want inside of Variables catagory
  4. Enjoy!

Credit

Created by @Swinsor
Fixed by @Kotojo

15 Likes

It counts up and instead of saying 120 seconds it says 2 minutes or whatever it may be.
thats all.

I can assure you I did not copy any of your stuff, heres why:
https://devforum.roblox.com/t/cleantime-the-time-module/372919/2
The original post for this was in October '19

2 Likes

Hope this clears up any worries for you! Awesome system btw!

2 Likes

I know it’s quickly made, but why LocalScript instead ModuleScript for modules, and why not just store it by seconds and use divide to get minutes and hours, and why not functions instead of setting them to TextLabel?
Or alternatively you could use one of my module, CLDRTools which supports plurals for seconds.

local CLDR = require(game.ReplicatedStorage.CLDRTools)
local TimeSpan = require(game.ReplicatedStorage.DateTime).TimeSpan;

local en = CLDR.Locale.new('en', 'US')

function cleantime(t, display_extra)
	if display_extra then
		if t >= TimeSpan.FromDays(1) then
			return ('%s, %s, %s, %s'):format(
				CLDR.Units.FormatUnit(en, t.Days, 'duration-day'), 
				CLDR.Units.FormatUnit(en, t.Hours, 'duration-hour'),
				CLDR.Units.FormatUnit(en, t.Minutes, 'duration-minute'),
				CLDR.Units.FormatUnit(en, t.Seconds, 'duration-second'));
		elseif t >= TimeSpan.FromHours(1) then
			return ('%s, %s, %s'):format(
				CLDR.Units.FormatUnit(en, t.Hours, 'duration-hour'),
				CLDR.Units.FormatUnit(en, t.Minutes, 'duration-minute'),
				CLDR.Units.FormatUnit(en, t.Seconds, 'duration-second'));
		elseif t > TimeSpan.FromMinutes(1) then
			return ('%s, %s'):format(
				CLDR.Units.FormatUnit(en, t.Minutes, 'duration-minute'),
				CLDR.Units.FormatUnit(en, t.Seconds, 'duration-second'));
		end;
	else
		return CLDR.Dates.FormatTimeSpan(en, t, 'second', 1)
	end;
	return CLDR.Units.FormatUnit(en, t.Seconds, 'duration-second');
end;

local secs = 0;
while wait(1) do
	secs = secs + 1;
	print(cleantime(TimeSpan.FromSeconds(secs), true));
end

1 second
2 seconds
3 seconds

59 seconds
1 minute, 1 second
1 minute, 2 seconds
1 minute, 3 seconds
1 minute, 4 seconds

4 Likes

That’s an awesome addition. Mind if I mark this as a solution?

1 Like

Don’t mind, you can mark it as a solution.

2 Likes

I’ll be redesigning this in the coming months. Stay tuned.

2 Likes