✓ Accepted answer
Insert the following Script into ServerScriptService:
local MarketplaceService = game:GetService("MarketplaceService")
local HealthID, PointsID = 19476978, 19535279
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == HealthID then
player.Character.Humanoid.Health = 100
elseif receiptInfo.ProductId == PointsID then
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1000
end
end
end
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
PurchaseHistory:IncrementAsync(playerProductKey, 1)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Insert the following Scripts into the 2 Buttons:
local productId = 19535279
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
local productId = 19476978
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)
1 comment
Spoonfed btw