Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Inconsistencies with dev products?

Asked by 3 years ago

So idk if this is a network problem or something but i have a very simple script that clones a folder from serverstorage to your players pets folder when you purchase a developer product, now the issue is that sometimes it works and sometimes it doesn't. Maybe its a loading issue with the entire game since there are alot of scripts? or is there some roblox issues?

local MarketPlaceService = game:GetService("MarketplaceService")
local DPID = 1178453273
local Players = game:GetService("Players")

MarketPlaceService.ProcessReceipt = function(ReceiptInfo)
    local Player = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)  
    if Player then
        if ReceiptInfo.ProductId == DPID then
            local ServerStorage = game:GetService("ServerStorage")
            local RobuxPets = ServerStorage:WaitForChild("RobuxPets")
            local DemonicDominus = RobuxPets:WaitForChild("Demonic Dominus")
            local DemonicDominusClone = DemonicDominus:Clone()
            DemonicDominusClone.Parent = Player:WaitForChild("Pets")
            local PetID = DemonicDominusClone:FindFirstChild("PetID")
            local Rand = math.random(2,1000000)
            print(Rand)
            PetID.Value = Rand
            return Enum.ProductPurchaseDecision.PurchaseGranted
        end
    else
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
end
0
use game.Players because I think it creates a Service. Idk try it? acediamondn123 147 — 3y

Answer this question