Making Dev Product Gifts Using Profile Service

If you aren’t familiar with ProfileService, please read about it first. I am also trying to gift developer products to the datastore that the player uses, not a separate one

As you may know, in ProfileService there’s session locking.

It’s easy to gift developer products to another player that is playing inside the same server, if they are not offline, you can just load their datastore and release it after the gift, but what if they are playing in another session?
How would the “gift” arrive? I’ve seen about GlobalUpdates but they are slow, would there be more options?

GlobalUpdates are your easiest option for sending a gift to a player in another server. This would also be your one stop shop as it would load for players who are offline and come online, as well as giving them to players in other servers.

You would only have to implement code once for both cases, rather than making a case to go and load their data if it isn’t loaded in another server, and would just send it directly to the player if they’re in another server.

Edit: Here’s a link to a tutorial for how to use GlobalUpdates (if you’re using ProfileService you’ve probably already seen this. But it’s still good to go back and watch it again.) Global Updates: ProfileService Tutorial Part 2 (Roblox Studio) - YouTube
And yes, GlobalUpdates are slow, but they don’t take up any extra datastore calls, and still load relatively quickly. If the players are doing something in game, they’re not going to notice that this gifted item came a little while later. Unless they are in the server with a player who said they were gifting it. (You could easily add a disclaimer saying, “If you’re online while the gift is coming, it may take a little more time.”)

1 Like

Once thing that pisses me off is, what if I make a “battle” pass gifting system? If the player already buys it while the gift is arriving? I am guessing I will need to implement a “battle” pass as in cash, so if such case happens the player can just get for free the next battlepass

You could always wait while they’re purchasing it and check the GlobalUpdates in the player’s data and if they have a pending gifted battlepass, you would simply not prompt them to purchase and say “Someone gifted this to you! It will arrive shortly!”

1 Like

Even if you check it again, there’s no proof that the data has already arrived, so to be sure I’ll just use the method I mentioned

Plus you cannot realize if there has been a global update until it arrives to you, therefore you could not tell them to wait for their gift

Under the GlobalUpdates on the API page, there’s the GetActiveUpdates and GetLockedUpdates, you could use this, have the server wait until you know that there are either 0 Globalupdates, or if they do have any, they aren’t the one for you gifting the battlepass.

https://madstudioroblox.github.io/ProfileService/api/#global-updates

Yes but that should be used when the profile loads, I cannot keep calling that function to ensure they got a battlepass, seems very hacky and still unsecure because of race conditions

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.