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?
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.
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.
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
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.