generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Hey guys a simple question here about time.

Previous Thread :: Next Thread 
vat21s is not online. vat21s
Joined: 07 Jun 2010
Total Posts: 2508
24 Mar 2015 09:51 PM
What would be the best way to get a non changing time scale. Such as GMT+0 or EST,PST ect?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 Mar 2015 10:03 PM
Well considering Roblox is PST, it might be better to use PST although either that or GMT (IMO).
Report Abuse
vat21s is not online. vat21s
Joined: 07 Jun 2010
Total Posts: 2508
24 Mar 2015 10:28 PM
I found a good method, I'll post it here just incase someone from the future needs something like this.

Step 1) Enable HTTPApi
Step 2) Make a new IntValue
Step 3) Place the following in a script inside the IntValue

local TimeServer = "http://www.timeapi.org/utc/now?%25Q"
local CurrentTime = Game:GetService("HttpService"):GetAsync(TimeServer, true)
local TimeGame = tick();
script.Parent.Value = TimeGame-CurrentTime

Step 4) When you want to check how much real time has passed, Use tick()-PathToIntValueHere
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
24 Mar 2015 11:16 PM
Using os.time() should get the current UTC time in seconds (since January 1970) on Roblox servers, if I remember correctly. Then you won't have to use all this HTTP mumbo jumbo.
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
25 Mar 2015 02:53 AM
Yes, os.time() was made explicitly for this purpose. It's guaranteed to accurate within a few seconds.
Report Abuse
ChiefDelta is not online. ChiefDelta
Joined: 05 Nov 2010
Total Posts: 13071
25 Mar 2015 02:54 AM
and guaranteed to be a pain in the ass to make readable

just use someone elses function for it

they usually involve like 3 loops 3 tables and such

elunate has one, lots of modules do too if u need that
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
25 Mar 2015 02:59 AM
preview.
c9.
io/lunate/skyewashere/Time.lua
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
25 Mar 2015 07:08 AM
http://www.roblox.com/Realtime--item?id=228079226
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image