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
 

Re: How to return ping using tick?

Previous Thread :: Next Thread 
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2015 05:23 PM
local getPing = function()
local tick1 = tick()
local unnecessary = game.ReplicatedStorage.Ping:InvokeServer()
local tick2 = tick()
return tick2-tick1
end

it gets the first tick before running the remotefunction, and then gets the second when the first one returns. This just returns numbers like 12.8348573489654396


trying to learn to hack on windows is like trying to play football in a body cast
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
17 Jul 2015 05:25 PM
ping is 12.83 milliseconds
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2015 05:26 PM
that can't be right

because i also got this

Ping: 0.00011944770812988


trying to learn to hack on windows is like trying to play football in a body cast
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
17 Jul 2015 05:27 PM
No, it's 12.83 seconds.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
17 Jul 2015 05:28 PM
"that can't be right

because i also got this

Ping: 0.00011944770812988"

Which would be
0.00012 seconds
or
0.12 milliseconds
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2015 05:30 PM
no, because it came back in like 1 second


trying to learn to hack on windows is like trying to play football in a body cast
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
17 Jul 2015 05:34 PM
Do it 10k times and get the average, or something.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Jul 2015 05:51 PM
That's not their ping, sorry to disappoint. But it's close enough.
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
17 Jul 2015 06:02 PM
@eLunate

HOW 2 PING


trying to learn to hack on windows is like trying to play football in a body cast
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
17 Jul 2015 06:04 PM
You can't really, but you can probably get a more accurate result by using RemoteEvents instead and some tick + os.time client/server trickery.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
17 Jul 2015 06:07 PM
how would you get ping then? this interests me too

would you do something like this? excuse me if i'm terribly wrong, it's just a guess:

-- local script
local plr = game.Players.LocalPlayer
local remoteFunction = plr:WaitForChild(plr.Name.."'s Function")

while wait(3) do -- invoke the server every 3 seconds to return their ping
local lastTick = tick()
local ping = remoteFunction:InvokeServer(lastTick)
print(ping)
-- ????
end

-- server script

game.Players.PlayerAdded:connect(function(plr)
local remoteFunction = Instance.new("RemoteFunction", plr)
remoteFunction.Name = plr.Name.."'s Function"

function remoteFunction.OnServerInvoke(tick)
local currentTick = tick()
local ping = currentTick - tick
return ping
end
end)

???
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
17 Jul 2015 06:24 PM
There should be a built in function for this
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
17 Jul 2015 06:31 PM
muh skropt was wrong cos i used tick() on the server
and then compared it with the clients tick()

whoops

-- local script
local plr = game.Players.LocalPlayer
local remoteFunction = plr:WaitForChild(plr.Name.."'s Function")

while wait(3) do -- invoke the server every 3 seconds to return their ping
local lastTick = tick()
remoteFunction:InvokeServer()
local currentTick = tick()
local ping = currentTick - lastTick
print(ping)
-- ????
end

-- server script

game.Players.PlayerAdded:connect(function(plr)
local remoteFunction = Instance.new("RemoteFunction", plr)
remoteFunction.Name = plr.Name.."'s Function"

function remoteFunction.OnServerInvoke(tick)
return 'blah'
end
end)

and it looks like i did exactly the same thing as OP now

@not

ye good point
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