I’m making an activity tracker for my game. I know the basics and I know how this will turn out, however I’m running into this one issue.
Upon joining, the game stores your name into a table. Your name is also associated with the Tolerance
and Seconds
properties. Tolerance determines whether to count seconds or not.
PlayerAdded Script
:
spawn(function()
if Player:GetRankInGroup(sysTable.groupId) >= 8 then
sysTable.baristaActivityTable[Player.Name] = {false, 0}
local Tolerance = sysTable.baristaActivityTable[Player.Name][1]
local Seconds = sysTable.baristaActivityTable[Player.Name][2]
Tolerance = true
repeat
Seconds += 1
wait(1)
until not Tolerance
end
end)
PlayerRemoving Script
:
if sysTable.baristaActivityTable[Player.Name] then
local Tolerance = sysTable.baristaActivityTable[Player.Name][1]
local Seconds = sysTable.baristaActivityTable[Player.Name][2]
Tolerance = false
print(Seconds)
if Seconds > 10 then
local convertedSeconds = timeAndDate.Time(Seconds)
local convertedDate = timeAndDate.Date()
sendActivity(Player, convertedSeconds, convertedDate)
end
sysTable.baristaActivityTable[Player.Name] = nil
end
The issue here, is that it is printing 0
when it says print(Seconds)
in the PlayerRemoving script. It should print the amount of seconds the player was in-game, according to the PlayerAdded script.
Any way to fix this?