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(),)

2 comments

0

You didn't explain enough what you wanted to do

0

Okay one moment.