How to tell how much time has passed when firing from client to server?

I’ve only seen a few forums with this question, and none of the solutions I’ve attempted have worked so far. I’m aware of Quenty’s module thing, however when I tried to look into it, it appeared as if I’d have to go through a bunch of hoops of installing a good 2-3 different things just to get this one end-goal.

I’ve tried comparing tick() and passing it through and that didn’t work, as I learned that it behaves differently on server.

os.time() doesn’t work, as it only counts seconds and nothing shorter.

I’ve tried doing DateTime.now().UnixTimestampMillis / 1000, as someone suggested, but it didn’t seem to work all that well.

All I’m trying to do, essentially, is figure out the difference so I can subtract it from a stun time for swinging weapons that’s handled on the server, as it’s part of a stun system rewrite I’ve made. Is there some alternative, or am I going to have to download Quenty’s stuff in order to get any results?

(sorry if this isn’t entirely proper as well, this is literally my first devforum post lol)

1 Like

I would recommend looking at using Player:GetNetworkPing(). It won’t tell you the exact time that it took to pass the event, but it should be very close.

2 Likes

So in replacement for tick() or the others, I check this on the server side and it returns the ping of the user? (which, i guess, would be a rough estimate of how long it’d have taken to pass the event?)

will give it a shot rq, thanks for advice – will update

edit: nvm just read up that its local only lol

1 Like

Where? I tested it just now and you can use it on the server
image

1 Like

OH, i misread it. the documentation specified its use on client side, and i interpreted it as “this can only be done on the client”, instead of “these is what you have to do, if on the client”

1 Like

did some testing, and this does seem to be good enough! i’ll be doing more in-depth testing with my game’s testers, but thanks for your help!

1 Like