local marketplaceService = game:GetService("MarketplaceService")
local gamepassService = game:GetService("GamePassService")
local purchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local players = game:GetService("Players")

local gamepasses = {
	LimitBreaker = 710439667;
	
}

local checkPurchases = function(player)
	local purchaseData = Instance.new("Folder")
	purchaseData.Name = "Gamepasses"
	
	for name, id in pairs (gamepasses) do
		local gamepass = Instance.new("BoolValue")
		gamepass.Name = name
		gamepass.Value = false
		
		if gamepassService:PlayerHasPass(player, id) then
			gamepass.Value = true
		end
		
		gamepass.Parent = purchaseData
	end
	purchaseData.Parent = player
end

local purchaseFinished = function(player, assetId, purchased)
	if purchased then
		local gamepassName = nil
		for name, id in pairs(gamepasses) do
			if id == assetId then
				gamepassName = name
			end
		end
		
		if gamepassName then
			local playerGamepasses = player:WaitForChild("Gamepasses")
			local gamepass = playerGamepasses:FindFirstChild(gamepassName)
			if gamepass then
				gamepass.Value = true
			end 
		end
	end
end

function marketplaceService.ProcessReceipt(receiptInfo)
	local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
	if purchaseHistory:GetAsync(playerProductKey) then
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
	local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	local status = player:FindFirstChild("Stats")
	if not status then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	
	if receiptInfo.ProductId == 36910199 then
		status.BoostX1.Value = 3600 
	elseif receiptInfo.ProductId == 36910179 then
		status.BoostX2.Value = 3600
	end
	purchaseHistory:SetAsync(playerProductKey, true)	
	return Enum.ProductPurchaseDecision.PurchaseGranted		
end

players.PlayerAdded:Connect(checkPurchases)
marketplaceService.PromptPurchaseFinished:Connect(purchaseFinished)
--This a other Script
local MarketplaceService = game:GetService("MarketplaceService")

local player = game.Players.LocalPlayer
local gamepassFolder = player:WaitForChild("Gamepasses")

local gamepasses = {
	
	[script.Parent:WaitForChild("")] = {"LimitBreaker", true, "Limit Breaker"};

}

for button, settings in pairs(gamepasses) do
	button.MouseButton1Click:Connect(function()
		if gamepasses then
			local asset = gamepassFolder:FindFirstChild(settings[1])
			if asset then
				if not asset.Value then
					MarketplaceService:PromptPurchase(player, button.Name)
				elseif settings[2] == true then
					game.ReplicatedStorage.Remotes.EditSkill:InvokeServer(settings[3])
				end
			end
		end
	end)
	
	button.Image = "https://www.roblox.com/Thumbs/Asset.ashx?width=110&height=110&assetId="..button.Name
end

3 comments

0

Im not sure whats going on here. Explain exactly WHAT the issue is, and any pertinent errors. People are much less likely to help you if you give them 100+ lines of code and no context.

0

I think Roblox I update the lua in MarketPlace Service or in GamePassService Then that script is in my game but I put the ids of my gamepasses and it tells me that it is not valid id then I want to be corrected the script with the new terms lua of Market Place And GamePassService gets its that that script makes when you buy it from the gamepass but you always have it on all the servers so to spea

0

I think I better send you message by roblox more detailed mind lol xd