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