Hello. I'd like to make it in my game so that everytime Lighting.TimeOfDay (or Lighting.ClockTime) reaches 6am, the player is awarded with 25 coins.
Current script:
local players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local DataStore2 = require(1936396537)
local defaultamount = 0
players.PlayerAdded:Connect(function(player)
local currencystore = DataStore2("Fazcoins", player)
local function playercurrency(amount)
RS.RemoteEvents.PlayerCurrency:FireClient(player, amount)
end
playercurrency(currencystore:Get(defaultamount))
currencystore:OnUpdate(playercurrency)
end)
while game.Lighting.ClockTime(6) do
for k, v in pairs(players:GetChildren()) do
local currencystore = DataStore2("Fazcoins", v)
currencystore:Increment(25)
end
end
Everything works if I do:
while wait([seconds]) do
-so the currency system itself is working. However, my attempts at getting it to respond to the clock time haven't worked. Any help is appreciated!
