f220099
(cclusi)
May 17, 2025, 7:50am
1
Studio:
time is synced on client and server
In-game:
client-side ^
server-side ^
code:
local PlayTime = math.ceil(tick() - Player:GetAttribute(“JoinTime”))
print(PlayTime)
to see how much seconds you play it’s the same ^ (for client and server)
the attribute setting happens on server:
Players.PlayerAdded:Connect(function(Player)
task.spawn(function()
Player:SetAttribute(“JoinTime”, tick())
please any help!
1 Like
From the documentation on Roblox Globals:
tick() isn’t officially deprecated, but has a variety of issues. It can be off by up to one second and returns inconsistent results across time zones and operating systems. Use os.time() , os.clock() , or time() instead. Also consider DateTime.UnixTimestamp and DateTime.UnixTimestampMillis .
2 Likes
f220099
(cclusi)
May 17, 2025, 8:10am
3
os.time() helped me, i also tried time() it does same problem
Pretty sure time()
returns precise elapsed time since the environment started, meaning server and different clients will all return different times.
1 Like
system
(system)
Closed
May 31, 2025, 8:15am
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.