os.time()
is a built in roblox function that returns the amount of time (in seconds) that has passed since January 1st, 1970. It's more efficient than tick() because it isn't affected by the time zone that the server is running in, whereas tick() is affected by time zones.
To use os.time()
, simply call the function, like so:
local Time = os.time() print(Time) --This will print a large number because it's in seconds.
Using os.time()
, you can tell how much time has passed since a person has played a game, you can get the seconds, minutes, hours, days, years, etc... that have passed since January 1st, 1970, and you can do a lot of other stuff that involve using time, but you don't want to be affected by time zones.
Hope this helped!
NOTE: Using os.time()
in a LocalScript
will return the same value as it would if used in a Server-Side Script
This will likely tell you as much as you need to know. (as long as you have ample knowledge of data tables)
"os.time()" returns the amount of seconds since the epoch (which is January 1, 1970 00:00 or something). This is based off of server time I believe. "tick()" has the same function but local time-zones are applied.