How to get exact milliseconds since epoch

How would I get the exact amount of milliseconds passed since epoch? Couldn’t really find any other post about this which would help, so I came here.

tick() has what you need. it is down to the mil sec

1 Like

Doesn’t tick() also use the amount of seconds passed since epoch?

What specifically do you need this for? There could be an easier way to solve your problem.

Don’t think there are any functions that’ll give you the exact millisecond since the epoch.
Not sure why you would need the exact millisecond but I guess you could just sync a loop to tick() and have it update every millisecond

pretty sure tick() returns milliseconds too but I find it odd that you need ms to do something

Trying to get the amount of milliseconds that has passed since a PLAYER has fired a remote.

here:

local time = tick() -- start timer

wait(5) -- example delay

local finishTime = tick() -- end timer

print(1000*(finishTime - time)) -- get timer time
1 Like

1000 times to turn seconds into milliseconds.

1 Like

yes…just not explicitly. Just multiply the seconds by 1000 to convert it into milliseconds. It is simple unit conversion.

local ms = tonumber(tostring(DateTime.now()))

Edit: Use this instead

local ms = DateTime.now().UnixTimestampMillis
8 Likes