From 75eacef99f9c9287f6d868dbb14277063d9c3673 Mon Sep 17 00:00:00 2001 From: I-Have-An-Issue <34550332+I-Have-An-Issue@users.noreply.github.com> Date: Sun, 12 Feb 2023 21:53:23 -0500 Subject: [PATCH] Idk --- src/lua/gameserver.lua | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/lua/gameserver.lua b/src/lua/gameserver.lua index 7d6b00f..236826c 100644 --- a/src/lua/gameserver.lua +++ b/src/lua/gameserver.lua @@ -31,12 +31,25 @@ function update(LeavingPlayer) end function keepAlive(LeavingPlayer) - game:GetService("HttpService"):PostAsync("https://dungblx.cf/API/KeepAlive", game:GetService("HttpService"):JSONEncode({ - ["ServerIP"] = jobId, - ["PlaceId"] = game.PlaceId, - ["PlayerCount"] = #game:GetService("Players"):GetPlayers(), - ["PlayerList"] = update(LeavingPlayer), - })) + local success, result = pcall(function() + game:GetService("HttpService").HttpEnabled = true + + local body = game:GetService("HttpService"):JSONEncode({ + ["ServerIP"] = jobId, + ["PlaceId"] = game.PlaceId, + ["PlayerCount"] = #game:GetService("Players"):GetPlayers(), + ["PlayerList"] = update(LeavingPlayer), + }) + + game:GetService("HttpService"):PostAsync("https://dungblx.cf/API/KeepAlive", body) + end) + + if not success then + local message = Instance.new("Message") + message.Text = "Ping Error: " .. result + message.Parent = workspace + game:GetService("Debris"):AddItem(message, 5) + end end -----------------------------------END UTILITY FUNCTIONS -------------------------