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