generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Weird problem with lag and tick()

Previous Thread :: Next Thread 
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
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
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
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
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
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
ExtremeBuilder15 is online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image