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

Why does this teleport prior to the purchase?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

1 answer

Log in to vote
0
Answered by 10 years ago

Are you trying to make it show the purchase??

0
Yes. User#1776 0 — 10y
0
Why, to show the person that there purchase was successful?? NinjoOnline 1146 — 10y
0
Never mind. I ONLY want you to be teleported if you purchase the item. So no. User#1776 0 — 10y
Ad

Answer this question