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)

1 comment
GamepassService is the one depricated now.