I am trying to do a countdown and for some reason when I do os.clock() on the client it says 186928 which is normal but how come on the server (the second one) it’s 101 million!? Is the server os.clock() different from the clients os.clock()? If so, how can I fix this! I am also wondering this cause on Roblox Studio, it’s fine and it says the 1 hour but once I actually load into game, it says over 100 or so days, so how can I fix this?
This is my code
ShopService:GetItemData(currentIndex):andThen(function(currentItem, purchasedItemsData)
local information = dealerShop:FindFirstChild("Information")
local playerMoney = information:FindFirstChild("PlayerMoney")
local timeLeftFrame = information:FindFirstChild("TimeLeft")
playerMoney.Title.TextColor3 = currentItem.Price >= cash and Color3.new(1,0,0) or Color3.new(1,1,1)
if not purchasedItemsData then
timeLeftFrame.Title.Text = "00:00:00"
return
end
local itemLife, timeBought = purchasedItemsData.TimeLeft, purchasedItemsData.TimeBought
print(itemLife, timeBought, os.clock())
if itemLife and tostring(itemLife) and itemLife == "Owns" then
--/ Owns gamepass which means time is inf
timeLeftFrame.Title.Text = "Inf"
elseif tonumber(itemLife) then
if itemLife - (os.clock() - timeBought) > 0 then
cashJanitor:Add(srv.run.RenderStepped:Connect(function()
--print(itemLife, os.clock(), timeBought)
local timeLeft = itemLife - (os.clock() - timeBought)
--print(timeLeft)
if timeLeft <= 0 then
timeLeftFrame.Title.Text = "00:00:00"
cashJanitor:Cleanup()
else
timeLeftFrame.Title.Text = Shared.CalculateTime(math.round(timeLeft))
end
end))
else
timeLeftFrame.Title.Text = "00:00:00"
end
else
timeLeftFrame.Title.Text = "00:00:00"
end
end)