Also correct me if I’m wrong, but ProxyService requires Heroku to work properly, but they stopped accepting free plans last month, so don’t use ProxyService unless if you’re willing to pay for it.
As for the OP, you’re going to have to look for other proxy options in order to accomplish this. Proxies and HttpService is the only way you can accomplish this.
game.ReplicatedStorage.AskServer.OnServerEvent:Connect(function(_, ID)
local HttpService = game:GetService("HttpService")
--make a proxy or use a public one to make it work
local function Proxy(url)
return url
end
local function GET(url)
url = Proxy(url)
local result
local Success, Error = pcall(function()
result = HttpService:GetAsync(url)
result = HttpService:JSONDecode(result)
end)
if Success then
return result
else
warn(Error)
end
end
local function getPlaceData(placeId)
local endpoint = "https://games.roproxy.com//v1/games/multiget-place-details?placeIds="..placeId
return GET(endpoint)
end
local function getUniverseData(universeId)
local endpoint = "https://games.roproxy.com//v1/games?universeIds="..universeId
return GET(endpoint)
end
--your place id
local PlaceData = getPlaceData(ID)
local universeId, isPrivate = PlaceData.universeId, PlaceData.isPlayable
print("game private:", isPrivate)
local UniverseData = getUniverseData(universeId)
local uncopylocked = UniverseData.copyingAllowed
print("uncopylocked:", uncopylocked)
end)
You might want to report this in the RoProxy thread. It appears this “Unathorized” bug is likely their issue since the multiget-place-details Roblox API works fine.
They’re trying to say that the isPlayable property cannot be accessed without authentication because checking whether or not a game is private or not depends on a player’s access, not globally.
As they have suggested, to check whether or not a game is private or not, create your own RoProxy Lite instance and modify the environment variables. Note that using this method will require your .ROBLOSECURITY cookie.
Also, you’ll see Heroku in one of the deploy options, DO NOT use Heroku as they have removed free plans last month.
Edit: Also this is all too complicated for me. All I’m trying to do is make sure that the player doesn’t think that the game is broken if the “This game is restricted” popup appears. Maybe there’s just a way of hiding that popup? That too would do what I’m trying to achieve in the first place.
local s = pcall(function()
game:GetService("TeleportService"):TeleportAsync(math.random(1, 10000000), {player})
end)
while not s do
s = pcall(function()
game:GetService("TeleportService"):TeleportAsync(math.random(1, 10000000), {player})
end)
end
It teleports a player to a game with a random ID between 1 and 10 million; if the player isn’t teleported (for any reason), it attempts to teleport the player to a different game with a random ID between 1 and 10 million.
Well, I’m trying to look for a way to find out if a game is public or not, because this is kinda what my script does and I don’t want the player to think the game has been broken if the popup that says “This game is restricted” shows on screen.
Touched upon most of this in the RoProxy thread already, but worth mentioning for anyone else looking to do the same thing in the future:
No game/place detail APIs will return a simple “private” or “public” property, they return an “isPlayable” property based on your team create access, group roles, etc. Previously, the “isPlayable” property would return a value corresponding to the game’s privacy settings when unauthenticated - however a recent change means it now always returns false.
However, I thought of a (somewhat hacky) solution since then.
local HttpService = game:GetService("HttpService")
--works equivalently to your getUniverseData function, pretty self-explanatory
function getUniverseData(universeId)
local response = HttpService:GetAsync("https://games.roproxy.com/v1/games?universeIds="..universeId)
return HttpService:JSONDecode(response)
end
--get a list of public games created by a user or group
function getCreatorPublicGames(creatorType, creatorId)
local endpoint = (creatorType == "User" and "https://games.roproxy.com/v2/users/%s/games?accessFilter=2&limit=50" or "https://games.roproxy.com/v2/groups/%s/games?accessFilter=2&limit=50")
local response = HttpService:GetAsync(string.format(endpoint, creatorId))
return HttpService:JSONDecode(response)
end
--return a boolean corresponding to the experience privacy
function isGamePublic(universeId)
local creatorData = getUniverseData(universeId).data[1].creator
local creatorGames = getCreatorPublicGames(creatorData.type, creatorData.id)
for i, gameData in pairs(creatorGames.data) do
if gameData.id == universeId then return true end
end
return false
end
--note that you should be generating game/universe ids as opposed to place ids, as typically only the root place is accessible.
local universeId = math.random(1, 1000000000)
print(isGamePublic(universeId))