In Central Alert I want you to have the user buy something that teleports you. It actually teleports you and never even mentions the purchase. Why doesn't this work? The first is the server script and the second is the client script.
local MarketplaceService = game:GetService("MarketplaceService")
local VIP = 19230420
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
-- find the player based on the PlayerId in receiptInfo
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
-- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)
if receiptInfo.ProductId == VIP then
game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(10, 325.100006, 61, 1, 0, 0, 0, 1, 0, 0, 0, 1))
else
end
end
end
-- record the transaction in a Data Store
local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId
PurchaseHistory:IncrementAsync(playerProductKey, 1)
-- tell ROBLOX that we have successfully handled the transaction (required)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
local MarketplaceService = Game:GetService("MarketplaceService")
local buyButton = StarterGui.buyButton
local productId = 19230420
StarterGui.buyButton.MouseButton1Click:connect(function()
MarketplaceService:PromptProductPurchase(player, productId)
end)
EDIT: The server script is StarterGui.buyButton.Script The client script is StarterPack.Script

3 comments
Yes.
Why, to show the person that there purchase was successful??
Never mind. I ONLY want you to be teleported if you purchase the item. So no.