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

My Skip Stage script for my obby doesn't seem to be working?

Asked by 5 years ago

So I have a gui in starter gui with a button, saying this local productId = 341212869 -- Change this to Robux developer product ID.

-- When player clicks on buy brick prompt him/her to buy a product function Click() game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId) end

script.Parent.MouseButton1Down:connect(Click)

And I have a another script in the gui saying this:

local passId = 341212869 local MPS = game:GetService("MarketplaceService")

local function isAuthenticated(userId, gamePassId) -- define outside the PlayerAdded event return MPS:UserOwnsGamePassAsync(userId, gamePassId) end

game:GetService("Players").PlayerAdded:Connect(function(plr) -- :connect is deprecated, use :Connect

plr.CharacterAdded:Connect(function(char) -- wait for the character! 
    if isAuthenticated(plr.UserId, passId) then
            if receiptInfo.ProductId == RobuxID then
            player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
    end
end)

end)

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Use MarketplaceService.UserOwnsGamePassAsync

You just use the Player.UserId as the first Argument and the Gamepasss ID as the second.

Wiki to it: https://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/UserOwnsGamePassAsync

Ad
Log in to vote
-1
Answered by
Envoked -11
5 years ago

MarketplaceService is deprecated I'm pretty sure. Use GamepassService instead.

0
GamepassService is the one depricated now. LegitmateTrades 159 — 5y

Answer this question