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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
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
|
  |
| 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 |
|
|