Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 1 year ago

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 answer

Log in to vote
0
Answered by 1 year ago
Ad

Answer this question