Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making a Gamepass GUI that gives the server Player Points when bought?

I tried to make one by replacing the developer pass GUI, but it just broke the gui when i tried to purchase it.

the script was

local productId = 20804763 -- change to your developer product ID
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() --DONT CHANGE THIS
	Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

how do I make it work for a gamepass and still give the server player points?

1 answer

✓ Accepted answer

I dug this out of my Database of scripts. According to this it was last accessed around 6 months ago so it should still work for you.

local buyButton = script.Parent
local productId = 19187437
local mps = game:GetService("MarketplaceService")

function getPlayerById(id)
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.userId == id then
			return v
		end
	end
end

buyButton.MouseButton1Click:connect(function()
	mps:PromptProductPurchase(game.Players.LocalPlayer, productId)
end)

mps.ProcessReceipt = function(info)
	--Give effects or whatever
end

This is just placed inside the GUI Button. I am pretty sure that all purchases ingame provide playerpoints, however gear purchases may not but I am unsure sorry.

1 comment

0

Thanks so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.