Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tried to use os.time() but it doesn't work?

Asked by 4 years ago
Edited 4 years ago
local Text = script.Parent
local TimeNow = os.time()
local data
local DataStore = game:GetService("DataStoreService"):GetDataStore("GreenCard")
game.Players.PlayerAdded:Connect(function(player)
pcall(function()
    data = DataStore:GetAsync(player.UserId.."-GreenCard")
    print("Getting data")
end)
if data ~= nil then
local timeSinceLastPlayer = TimeNow - data
print("Time since last play"..timeSinceLastPlayer)

    end
end)

It keeps printing in the output "ServerScriptService.Script:10: attempt to perform arithmetic on upvalue 'data' (a nil value)" I wanted to know when did the player last joined, (the script isn't finished yet), they buy something, after they buy that item the timer starts counting down 3 days even when the player leaves (Tried to use os.time(),)

0
You didn't explain enough what you wanted to do Eternalove_fan32 188 — 4y
0
Okay one moment. fortesss7 40 — 4y

Answer this question