I have it put into a local script and not sure what I am missing also put it in ScriptService, I really need help with this
game.StarterGui.ResetPlayerGuiOnSpawn = false
old_fog = game.Lighting.FogStart
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 == 84313872 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 1000
end
elseif productId == 84313907 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 5000
end
elseif productId == 84314088 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 10000
end
elseif productId == 84313964 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 50000
end
elseif productId == 84314013 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 100000
end
elseif productId == 84315118 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 1000000
end
elseif productId == 84342316 then
local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
local char = player.Character
char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 25
wait()
char.Humanoid.Health = char.Humanoid.MaxHealth
elseif productId == 84343085 then
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = human.WalkSpeed + 25
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
and the script I'm using for it
for i,v in pairs(script.Parent.Buttons:GetChildren()) do
if v:isA("TextButton") then
v.MouseButton1Click:connect(function()
pcall(function()
if v:FindFirstChild("Pass") then
game.MarketplaceService:PromptPurchase(game.Players.LocalPlayer,tonumber(v.Name))
else
game.MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer,tonumber(v.Name))
end
end)
end)
end
end
