I am currently working on an offline reward system that rewards users based on their offline time. The system is designed to provide a reward to users once every 24 hours, with the amount of reward based on how long they were offline. However, I’m experiencing some issues with the current method and it’s not working as intended.
local CurrentTime = os.time()
local LastLogin = Profile.Data.LastLogin
if (LastLogin or 0) > 0 then
local OfflineTime = CurrentTime - LastLogin
if (OfflineTime / 3600) >= 24 then
local CalculateOfflineReward = CalculateClicks(Player, Profile) * OfflineTime * 0.01
Profile.Data.Stats.Clicks += CalculateOfflineReward
Profile.Data.Stats.TotalClicks += CalculateOfflineReward
Player.Stats.Clicks.Value += CalculateOfflineReward
Player.Stats.TotalClicks.Value += CalculateOfflineReward
print(CalculateOfflineReward)
print(OfflineTime)
Profile.Data.LastLogin = os.time()
print(LastLogin)
end
else
print("New Player")
Profile.Data.LastLogin = os.time()
end
I hope you can help me