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: Getting Consistent Server Time?

Previous Thread :: Next Thread 
Tarkol is not online. Tarkol
Joined: 03 Feb 2010
Total Posts: 425
22 Feb 2015 10:31 PM
Question: I was wondering if there is a specific "Server Time" that sticks even when all instances of a place are closed. If not, is it possible to script this?

How I would apply: I made a gui to award money to players, however I want a maximum amount per day to be awarded, that way admins can't just give their friends millions.

Thanks
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Feb 2015 10:50 PM
os.time and datastores
Report Abuse
Tarkol is not online. Tarkol
Joined: 03 Feb 2010
Total Posts: 425
22 Feb 2015 11:19 PM
So if I use the following script as a template:

local RewardTime = 24*60*60 --How often they get the reward in seconds --This is 24 hours

local DataStore = game:GetService("DataStoreService"):GetDataStore("LastLogin")
local Player = script.Parent.Parent.Parent.Parent
local LastLogin = DataStore:GetAsync(Player.userId) or os.time()

while true do
Seconds = RewardTime-(os.time()-LastLogin);
Minutes = Seconds/60;
Hours = Minutes/60;
script.Parent.Text = ("Time Until Next Reward: %02d:%02d:%02d"):format(Hours,Minutes%(60),Seconds%(60))
wait(1)
end

I could insert a value that goes up by 1 every time a credit is added, and then once that value hits 20, have something like

if creditmax.Value = 20 then break end

Then the credits would be blocked, and in the datastore script have something like
if hours >= 24 then creditmax.Value = 0


Theoretically, if this was all put together, then they would only have a daily credit allowance of 20, which resets. Right?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
22 Feb 2015 11:24 PM
Yeah you could do that, and set the "creditsmax" back to 0 when (os.tick() - LastLogin) is >= RewardTime
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