I am working on a script in ServerScriptStorage that gives you skips but PromptPurchaseFinished does not detect anything happening. I have the prompt for the developer product be given by a local script in the player gui as you buy the skips from a player gui. Here is my script in ServerScriptService.
SkipGampess = {{1022226653, 5}, {1022246676, 10}, {1022248516, 25}, {1022247497, 50}, {1022247956, 100}} game:GetService("MarketplaceService").PromptPurchaseFinished:Connect(function(plrId, productId, purchased) print("PurchaseDetected") if purchased then print("WasPurchsaed") for i, v in pairs(SkipGampess) do if SkipGampess[1] == productId then for a, b in pairs(game:GetService("Players"):GetChildren()) do if b.userId == plrId then v:WaitForChild("playerVariables"):WaitForChild("Skips").Value = v:WaitForChild("playerVariables"):WaitForChild("Skips").Value + v[2] end end end end end end)
I would prefer using this script as I have used this in my game
script.Parent.MouseButton1Click:Connect(function() -- function for the gamepass purchase game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,-- Number of gamepass --) -- Using the marketplaceService and PromptGamePassPurchase for buying the gamePass. end) local player = game.Players.LocalPlayer -- Create variable for player local ownsGamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,-- Number of gamepass --) -- Checking if the player owns the gamePass if ownsGamepass then -- The functions for skipping the stage-- end
I know you know about roblox scripting but still writing to make it easy for you.
on line 7 shouldnt it be SkipGampess[i][1]
or v[1]
, you cant compare and id with an array
also game.Players:GetPlayers()
use this to loop over the players
and line 10 u can turn into
v:WaitForChild("playerVariables"):WaitForChild("Skips").Value += v[2]