Developer products used as license

Topic Is Closing

  1. What do you want to achieve?
    Hello, fellow scripters! I am trying to figure out how to check if a user has purchased a developer product. If the user has made the purchase, the script will run normally; if not, it should self-destruct.

  2. What is the issue?
    I managed to do this with game passes, but I’m struggling to achieve it with developer products. I suspect the difficulty arises from attempting to verify whether the user has bought the developer product in a different game that owns the developer product.

  3. What solutions have you tried so far?
    I’ve searched for solutions from other scripters but couldn’t find any in dev forums or elsewhere. If you are a scripter who knows how to do this, please share some information on how to accomplish it, or demonstrate how you have done it. I’m not asking you to create any scripts; just provide ideas on how I could achieve this or confirm if it’s even possible!

Topic Is Closing

2 Likes

Any feedback is greatly appreciated!

Here’s the code I wrote. If you find any errors, please let me know! Or you could try to make it work!

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local productId = 1736670780

local function onPlayerAdded(player)
    local hasOwnedProduct = false

    local success, productInfo = pcall(function()
        return MarketplaceService:GetProductInfo(productId)
    end)

    if success then
        local playerOwnsProduct = MarketplaceService:UserOwnsGamePassAsync(player.UserId, productId)
        if playerOwnsProduct then
            print(player.Name .. " owns the developer product with ID " .. productId)
        end
    else
        warn("Error while checking if player owns developer product: " .. tostring(productInfo))
    end
end

-- Connect "PlayerAdded" events to the function
Players.PlayerAdded:Connect(onPlayerAdded)
1 Like

Well, my friend helped me out and said that I would need to rent or buy a database, but I’m not ready for that. So, I’ll be using game passes to check licenses instead!

your friend has no idea what he’s talking about, at all. when a player buys a developer product write a datastore entry for it in the MarketplaceService.ProcessReceipt callback.

He means to use it across games on the platform, not just a single game.

Yes, I’m trying to achieve it through all the games and not just one.

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