|
| 27 Mar 2017 09:03 PM |
Hi scripters forum. I'm trying to figure some stuff out with tick() and REs.
I have a RE that, in a server script, fires the client basically like this: RE:FireClient(plr, tick())
and is recieved like this: RE.OnClientEvent:connect(function(lag)) local elapsed time = tick() - lag
This all works fine and dandy in studio, but on the server it gets weird. The result I was getting was something like -3000 to -7000 seconds, so I added prints. print(time.."time ", "lag: "..lag, "tick"..tick())
and the tick() on the client is smaller than the tick() that is received from the server, by a lot. How is this possible? Am I doing something wrong? Anyone have a fix?
|
|
|
| Report Abuse |
|
|
|
| 27 Mar 2017 09:04 PM |
| What are you trying to do, measure ping? Use RemoteFunctions; they yield on whatever peer fired it until a result is found. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2017 09:06 PM |
No, I'm basically making a countdown that is on the server, but is smoothly replicated to the client.
I subtract the time between server and client from the total time, then start the loop from there. I don't think a RF would be the answer to this.
|
|
|
| Report Abuse |
|
|
|
| 27 Mar 2017 09:11 PM |
Ok, I think I've found the solution on the wiki. I forgot that tick() changes between machines. Would time() be a viable option to replace it?
|
|
|
| Report Abuse |
|
|