Developer Product to mass teleport

General questions and my answers:

  1. What do you want to achieve?: When players buy a developer product it should bring all the players to a part.

  2. What is the issue?: The purchase goes through yet nobody teleports to the part.

I’ve decided to move all players’ HumanoidRootPart to the part’s position, yet nothing goes through.

local MarketplaceService = game:GetService("MarketplaceService")
local RestartPart = game.Workspace.Special.RestartPart.Position

function processReceipt(receiptInfo)
	local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	if(receiptInfo.ProductId == --[[ devproduct is here]]) then
		for i, player in ipairs(game.Players:GetPlayers()) do
			if player.Character then
				local hum = player.Character:FindFirstChild('Humanoid')
				local tp = hum.Parent
				if hum then
					tp.Position = RestartPart
				end
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processReceipt

Try:

if player.Character then
	local hum = player.Character:FindFirstChild('Humanoid')
	local tp = hum.Parent
	  if hum then
		tp:PivotTo(RestartPart.CFrame)
	end
end

Also, I believe you should put this return Enum.ProductPurchaseDecision.PurchaseGranted within the if receiptInfo.ProductId =..

Try:

local MarketplaceService = game:GetService("MarketplaceService")
local RestartPart = game.Workspace.Special.RestartPart.Position

function processReceipt(receiptInfo)
	local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end

	if(receiptInfo.ProductId == --[[ devproduct is here]]) then
		for i, player in ipairs(game.Players:GetPlayers()) do
			if player.Character then
	           local hum = player.Character:FindFirstChild('Humanoid')
	           local tp = hum.Parent
	           if hum then
		         tp:PivotTo(RestartPart.CFrame)
	           end
           end
		end
       return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

MarketplaceService.ProcessReceipt = processReceipt
1 Like

Hey, thank you so much, also had to fix the

local RestartPart = game.Workspace.Special.RestartPart.Position

to remove the position for the cframe to work. Many thanks, have a good one!