Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I get the server's ping? (yup, again)

Asked by 2 years ago

I tried with (300 - ((1 / wait()) * 10) but I just get negative numbers up to -5 Here's my code on ServerScriptService:

game:GetService("MessagingService"):SubscribeAsync("ServerList_Update", function(data)
    local Data = data.Data

    if data.JobID ~= game.JobId then
        local clone = script.ServerName:Clone()
        local intFolder = clone.Int
        local IDsFolder = clone.IDs
        local DevicesFolder = clone.Devices

        clone.Name = "Server_"..#game.ReplicatedStorage.Servers:GetChildren() + 1
        clone.Value = Data.JobID.."|"..Data.Players

        clone.Ping.Value = Data.Ping
        intFolder.FPS.Value = Data.FPS
        intFolder.PlaceVersion.Value = Data.PlaceVersion
        intFolder.Players.Value = Data.Players
        IDsFolder.JobID.Value = Data.JobID
        IDsFolder.GameID.Value = Data.GameID
        IDsFolder.PlaceID.Value = Data.PlaceID
        clone.Location.Value = ""

        clone.Parent = game.ReplicatedStorage.Servers
        wait(1)
        clone:Destroy()
    end
end)

while game.VIPServerId == "" do
    local data = {
        JobID = game.JobId;
        Players = #game.Players:GetPlayers();
        FPS = workspace:GetRealPhysicsFPS();
        Ping = (300 - ((1/wait()) * 10));
        GameID = game.GameId;
        PlaceID = game.PlaceId;
        PlaceVersion = game.PlaceVersion;
    }

    game:GetService("MessagingService"):PublishAsync("ServerList_Update", data)
    wait(1)
end

1 answer

Log in to vote
1
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

Try https://devforum.roblox.com/t/playerping-get-client-ping-times-on-the-server/813039

Ad

Answer this question