Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

PlayerMoney is not a valid member of ServerStorage "ServerStorage"?

game.StarterGui.ResetPlayerGuiOnSpawn = false

local MarketplaceService = game:GetService("MarketplaceService")

function getPlayerFromId(id) for i,v in pairs(game.Players:GetChildren()) do if v.userId == id then return v end end return nil end

MarketplaceService.ProcessReceipt = function(receiptInfo) local productId = receiptInfo.ProductId local playerId = receiptInfo.PlayerId local player = getPlayerFromId(playerId) local productName if productId == 33240909 then productName = "$2,000" local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 2000 end elseif productId == 33240915 then productName = "$5,000!" local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 5000 end elseif productId == 33240918 then productName = "$10,000!" local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 10000 end elseif productId == 33240922 then productName = "$25,000" local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name) if cashmoney then cashmoney.Value = cashmoney.Value + 25000 end elseif productId == 33279599 then productName = "Heatseeking Rocket" game.Lighting.HeatRocket:Clone().Parent=player.Backpack elseif productId == 33305981 then productName = "Jetpack" game.Lighting.Jetpack:Clone().Parent=player.Backpack elseif productId == 33279596 then productName = "Minigun" game.Lighting.Minigun:Clone().Parent=player.Backpack end game.BadgeService:AwardBadge(playerId,202303025) local message = Instance.new("Hint",workspace) message.Text = player.Name.." purchased "..productName.."!" coroutine.resume(coroutine.create(function() wait(2) message:destroy() end))

return Enum.ProductPurchaseDecision.PurchaseGranted		

end

1 comment

0

Format your code if you want help

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.