DoorController Not Working

My script should open the door once the DevProduct has been purchased, without having to rejoin as it will check every 10 seconds, however, I’m getting an error saying that something is not a member of EnumInfoType, the thing that should get your purchased DeveloperProducts, is there a way to fix this?

Thanks,
@peter

Why check every 10 seconds?

Only check every time the user tries to go through the door and once you get the positive that they’ve bought it stop checking and just set the door to non cancollide.

Please show the scripts.

@peter is it not possible to use MarketplaceService:UserOwnsPass() or am I getting something wrong here?

Could I please see your script so I can make sure you haven’t done something wrong? :smiley:

He’s using a dev product.

In a change to this, don’t repeatedly check or check when the user touches the door, I’m pretty sure there is some type of event when a user buys a developer product with using the bill or something along those lines.

1 Like

Do you mean ProcessReceipt or ?

Not exactly. @CookieTechAi Create a script for Roblox on the server side using the MarketplaceService PromptProductPurchaseFinished and verify it to a devproductid and print “Bought correct product”.

Sure, here’s the updated script that only checks if the purchase was successful:

local MarketplaceService = game:GetService("MarketplaceService")

-- The expected DevProduct ID that the user should purchase
-- Replace this with your own DevProduct ID
local DEV_PRODUCT_ID = 123456789

MarketplaceService.PromptProductPurchaseFinished:Connect(function(player, purchaseInfo)
    -- Verify if the purchase was successful
    if purchaseInfo.ProductId == DEV_PRODUCT_ID and purchaseInfo.PurchaseState == Enum.PurchaseState.Purchased then
        print("Bought correct product")
        
        -- Update game state here, like allowing the player to open the door
    end
end)

Now the script checks if the purchase was successful using the PurchaseState property of the purchaseInfo table. It will only execute the code if the purchase was successful.

I don’t think this is perfect, but it should be something like this.

If I remember correctly it should be:

MarketplaceService.PromptProductPurchaseFinished:Connect(function(playerUserId, PurchasedProductId, Purchase)

if Purchase == true and PurchasedProductId == DevProduct then 
      print("Bought!")
end

Where in the script would I place this? I’ve sent it to you in DM’s.

Is there another part of the script in your door operator before the checker

Not that’s glitched, as it’s just the info type from the Enum.

oh, i just realized, there is already a purchase ProximityPrompt in a separate script, this script is just constantly checking to see if anyone’s bought the dev product, then it opens the door to everyone as it’s a party.

2 Likes

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