Dev product doesent teleport everyone when supposed to

im making some sort of minigame thing for robux and the devproduct isnt working as its supposed to
when theres a spleef minigame bought the only person who gets teleported is the buyer when im using :getplayers for it

local function processReceipt(receiptInfo)

	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)



	if receiptInfo.ProductId == 1268366742 then

		for i, player in pairs(game.Players:GetPlayers()) do
			local char = player.Character
			local hum = char:WaitForChild("Humanoid")
			local sword = game.ReplicatedStorage.Tools.Sword:Clone()

				local popup = script.PopUp:Clone()
				popup.Message.Text = plr.Name.." Gave Everyone a Sword!"
				popup.Parent = player.PlayerGui.ScreenGui
				popup.LocalScript.Disabled = false
	
				sword.Parent = player.Backpack
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end

	if receiptInfo.ProductId == 1268521737 then

		for i, player in pairs(game.Players:GetPlayers()) do
			local char = player.Character
			local hum = char:WaitForChild("Humanoid")
			local Parts = game.ReplicatedStorage.Disasters.FallingParts:Clone()
			
				local popup = script.PopUp:Clone()
				popup.Message.Text = plr.Name.." Made it rain parts!"
				popup.Parent = player.PlayerGui.ScreenGui
				popup.LocalScript.Disabled = false
	
			Parts.Parent = workspace.Assets
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if receiptInfo.ProductId == 1268525578 then

	for i, player in pairs(game.Players:GetPlayers()) do
		local char = player.Character
		local hum = char:WaitForChild("Humanoid")
		local Parts = game.ReplicatedStorage.Disasters.House:Clone()

			local popup = script.PopUp:Clone()
			popup.Message.Text = plr.Name.." Spawned a House!"
			popup.Parent = player.PlayerGui.ScreenGui
			popup.LocalScript.Disabled = false
		
			game.ReplicatedStorage.Values.HouseSpawned.Value = true
		Parts.Parent = workspace.Assets
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if receiptInfo.ProductId == 1268525518 then

		for i, player in pairs(game.Players:GetPlayers()) do
			local char = player.Character
			local hum = char:WaitForChild("Humanoid")
			local Parts = game.ReplicatedStorage.Disasters.GlassGame:Clone()
			
				local popup = script.PopUp:Clone()
				popup.Message.Text = plr.Name.." Started Glass Bridge!"
				popup.Parent = player.PlayerGui.ScreenGui
				popup.LocalScript.Disabled = false
		
			game.ReplicatedStorage.Values.GlassRunning.Value = true
			Parts.Parent = workspace.Assets
			player.Character.HumanoidRootPart.CFrame = workspace.Teleports.GlassTeleport.CFrame
			wait(240)
			Parts:Destroy()
			game.ReplicatedStorage.Values.GlassRunning.Value = false
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if receiptInfo.ProductId == 1268571595 then

		for i, player in pairs(game.Players:GetPlayers()) do
			local char = player.Character
			local hum = char:WaitForChild("Humanoid")
			local spleef = game.ReplicatedStorage.Disasters.Spleef:Clone()
			local tool = game.ReplicatedStorage.Tools.SpleefMiner:Clone()
			
				local popup = script.PopUp:Clone()
				popup.Message.Text = plr.Name.." Started Spleef!"
				popup.Parent = player.PlayerGui.ScreenGui
				popup.LocalScript.Disabled = false

			game.ReplicatedStorage.Values.SpleefRunning.Value = true
			spleef.Parent = workspace.Assets
			tool.Parent = player.Character
			player.Character.HumanoidRootPart.CFrame = workspace.Teleports.SpleefTeleport.CFrame
			wait(120)
			tool:Destroy()
			spleef:Destroy()
			game.ReplicatedStorage.Values.SpleefRunning.Value = false
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if receiptInfo.ProductId == 1268586323 then

		for i, player in pairs(game.Players:GetPlayers()) do
			local char = player.Character
			local hum = char:WaitForChild("Humanoid")
			local boss = game.ReplicatedStorage.Disasters.Boss:Clone()
			
				local popup = script.PopUp:Clone()
				popup.Message.Text = plr.Name.." Started a Boss Fight!"
				popup.Parent = player.PlayerGui.ScreenGui
				popup.LocalScript.Disabled = false

			game.ReplicatedStorage.Values.BossSpawned.Value = true
			boss.Parent = workspace.Assets
			wait(120)
			boss:Destroy()
			game.ReplicatedStorage.Values.BossSpawned.Value = false
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if receiptInfo.ProductId == 1268366699 then
		local sword = game.ReplicatedStorage.Tools.Sword
		if plr then
			sword.Parent = plr.Backpack
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end

	
end

MarketplaceService.ProcessReceipt = processReceipt

the post didnt really go off i hope a repost makes this get more attention and hope i can fix it

Your code is causing each step of your loop to yield the thread for 2 minutes, causing only one player to teleport to the match and having to wait the full duration there before the next player can be teleported.

If you want your code to work as intended, you need to modify it such that you set up the match, then iterate through every player to give them the proper equipment and move them to the proper location, wait the full duration of the match, and then clean up the match afterwards.

Something like this should suffice, although I have no way of testing it.

if receiptInfo.ProductId == 1268571595 then
	-- Initialize Spleef match	
	local spleef = game.ReplicatedStorage.Disasters.Spleef:Clone()
	spleef.Parent = workspace.Assets
	game.ReplicatedStorage.Values.SpleefRunning.Value = true
	
	-- Intialize player equipment and move them to the correct location
	for i, player in pairs (game.Players:GetPlayers ()) do
		local char = player.Character
		local hum = char:WaitForChild ("Humanoid")
		local tool = game.ReplicatedStorage.Tools.SpleefMiner:Clone ()

		local popup = script.PopUp:Clone()
		popup.Message.Text = plr.Name.." Started Spleef!"
		popup.Parent = player.PlayerGui.ScreenGui
		popup.LocalScript.Disabled = false

		tool.Parent = player.Character
		player.Character.HumanoidRootPart.CFrame = workspace.Teleports.SpleefTeleport.CFrame
	end
	
	-- Wait until the match ends
	task.wait (120)
	
	-- Clean up player equipment
	for i, player in pairs (game.Players:GetPlayers ()) do
		local tool = player.Character:FindFirstChild ("SpleefMiner") or player.Backpack:FindFirstChild ("SpleefMiner")

		if tool then
			tool:Destroy ()
		end
	end
	
	-- Clean up Spleef match
	spleef:Destroy()
	game.ReplicatedStorage.Values.SpleefRunning.Value = false

	return Enum.ProductPurchaseDecision.PurchaseGranted
end