I want my plugin to SetSetting something on game publish, how can I know when studio publishes the game to Roblox?
you can certainly do this with DataModel.PlaceVersion
- cache the value of this on plugin start and then check periodically to see if it has increased
oh dear, what an oversight on my part. In that case I can’t think of a way to do this off the top of my head - I’ll edit my post here if I can think of something
What exactly is your goal?
It’s right there in the OP.
I mean in more clear detail, like exactly what’s happening I can’t really go off of that.
He wants to do something when the player publishes his game.
He wants to know how he can figure out when the player publishes their game.
I believe Artificiality is asking for the use case; there may be another way to achieve the end use case without determining when the game has been published since that seems difficult to do.
There are two methods I can think of. The first is probably the best, although neither are as nice as an event and must be queried continuously.
1. InsertService
This code will return a different value after a place has been updated (you actually have to make changes for the version to update):
game.InsertService:GetLatestAssetVersionAsync(game.PlaceId)
This method only works inside a currently running studio instance with an authenticated user and published game they own. It results in a 404 or 403: Forbidden otherwise.
2. Roblox web api
You will need a proxy if you plan to use the HttpService. This endpoint here: https://games.roblox.com/v1/games?universeIds={UNIVERSE_IDS} provides information on all the places in a game. Due to weird naming conventions and lots of history, this id is called game.GameId
in the DataModel. You can then JSON decode this and grab the ‘updated’ string to tell when the current place id was updated. The documentation for the endpoint is here: https://games.roblox.com/docs#!/Games/get_v1_games
This method works for other games besides the one currently running in studio, doesn’t need to be called from within Roblox, and no user has to be logged in.
When I queried it with one of my game id’s, I got this:
Example Response
https://games.roblox.com/v1/games?universeIds=20072039
{
"data": [
{
"id": 20072039,
"rootPlaceId": 31910009,
"name": "None",
"description": "",
"creator": {
"id": 554348,
"name": "IdiomicLanguage",
"type": "User"
},
"price": null,
"productId": null,
"isExperimental": true,
"allowedGearGenres": [
"All"
],
"allowedGearCategories": [],
"playing": 0,
"visits": 0,
"maxPlayers": 10,
"created": "2010-07-31T19:32:59.91",
"updated": "2018-11-27T03:06:41.0526049-06:00",
"studioAccessToApisAllowed": false,
"universeAvatarType": "PlayerChoice",
"genre": "All"
}
]
}
Mhm, you are correct about what I was asking for. Thanks for giving a solution!