On ROBLOX Tower I tried to have a developer product teleport the player instantly to their suite, the problem is it doesn't teleport them. I copied the code from PvP Battle which does work.
Here is the code:
local MarketplaceService = game:GetService("MarketplaceService") --local ds = game:GetService("DataStoreService"):GetDataStore("PvPPurchaseHistory") MarketplaceService.ProcessReceipt = function(receiptInfo) -- find the player based on the PlayerId in receiptInfo for i, player in pairs(game.Players:GetPlayers()) do if player.userId == receiptInfo.PlayerId then --while player:FindFirstChild("leaderstats") == nil do wait() end -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product) -- if(tonumber(receiptInfo.ProductId) == 19185476)then -- player.leaderstats.Money.Value = player.leaderstats.Money.Value + 100 -- end -- if(tonumber(receiptInfo.ProductId) == 19185483)then -- player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1000 -- end -- if(tonumber(receiptInfo.ProductId) == 19185503)then -- player.leaderstats.Money.Value = player.leaderstats.Money.Value + 10000 -- end if(tonumber(receiptInfo.ProductId) == 19620695)then pcall(function () game:GetService("TeleportService"):Teleport(suiteIds:GetAsync(tostring(p.userId)),p) end) end end end -- record the transaction in a Data Store --local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.PurchaseId --ds:IncrementAsync(playerProductKey, 1) -- tell ROBLOX that we have successfully handled the transaction (required) return Enum.ProductPurchaseDecision.PurchaseGranted end
I found out why... The suiteIds
variable doesn't exist. Then fixed the variable p
not existing by changing it to player
. I'm so happy for the in-game developer console.