I’m currently trying to make it so it getchildren all gamepass values to onPromptGamePassPurchaseFinished. Automatically gives them the product upon purchases, but that doesn’t seem to work.
local Players = game:GetService("Players")
for i,v in pairs(game.ReplicatedStorage:GetDescendants()) do
if v.Name=="Gamepass" then
local gamePassID = v.Value
local function onPromptGamePassPurchaseFinished(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == gamePassID then
print(player.Name .. " purchased the game pass with ID " .. v.Value)
local str = Instance.new("NumberValue", player.Character.Gamepass)
str.Name=gamePassID
str.Value=gamePassID
end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(onPromptGamePassPurchaseFinished)
end end
I’m doing this because I have a bunch of values. So It’d be smarter to do a getchildren. Anything helps, thank you in advance.