When you get sent to jail, get the time using os.time. When I leave the game, use os.time again, and subtract the start time from it to get the amount of time you have been in jail.
--when jailing
plr.Data.JailStartTime = os.time()
plr.Data.JailTime= sentenceTime -->> 30
-- when leaving
plr.Data.JailTimeLeft = os.time() - plr.Data.JailTime
-- upon joining, if there is time left, send them to jail and wait out the time
I think you should check if the specified time has passed like this:
local JailTime = 10 * 60
plr.Data.JailStartTime = os.time()
plr.Data.JailTime= sentenceTime -->> 30
plr.Data.JailTimeLeft = os.time() - plr.Data.JailTime
if plr.Data.JailTimeLeft >= JailTime then
print("Jail time is over")
else
print("Jail time is not over yet")
end