Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use os.time()?

Asked by 10 years ago

I think the title is self-explanatory.

3 answers

Log in to vote
0
Answered by 10 years ago

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

Ad
Log in to vote
0
Answered by
RoboFrog 400 Moderation Voter
10 years ago

This will likely tell you as much as you need to know. (as long as you have ample knowledge of data tables)

0
Problem is....I don't. I actually read that first, still didn't understand, so I went here VongolaXII 15 — 10y
Log in to vote
0
Answered by 10 years ago

"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.

Answer this question