I can't figure out how to remove this loop without wrecking everything can someone help?
game:GetService("MarketplaceService").ProcessReceipt = function(Info)
for i,v in pairs(game.Players:GetPlayers()) do -- Loop
if Info.PlayerId == v.UserId then
local Data = v:FindFirstChild("Data")
if Data then
if Info.ProductId == 179386976 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 50
elseif Info.ProductId == 179387184 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 100
elseif Info.ProductId == 179387310 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 250
elseif Info.ProductId == 179387552 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 500
elseif Info.ProductId == 179387687 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 1000
elseif Info.ProductId == 179388074 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 2500
elseif Info.ProductId == 179388286 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 500
elseif Info.ProductId == 179388406 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 1000
elseif Info.ProductId == 179388772 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 5000
elseif Info.ProductId == 179388926 then
Data.Stats.Gold.Value = Data.Stats.Gold.Value + 10000
end
game.ReplicatedStorage.Events.UpdateLevel:FireClient(v)
end
end
end
end

3 comments
I tried doing what you said but it only disabled the function of being able to purchase the object
I'm guessing the whole script broke because it's not "receiptInfo" but "Info".. so:
local player = game:GetService("Players"):GetPlayerByUserId(Info.PlayerId)