I have a gamepass that when they accept, they have there walkspeed set to 16, and when they decline, they get teleported to the game there already in (in other words a forced rejoin) the walkspeed part works but the teleport dosnt, here is the receipt script:
--serverecriptservice
local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local Tele = game:GetService("TeleportService")
local purchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory")
local productFunctions = {}
productFunctions[1266365674] = function(receipt, player)
player.Stats.CanWalk.Value = true
return true
end
function DeveloperProductsRecieptCompleted(Player, ProductId, wasPurchased)
if wasPurchased == true then
else
Tele:Teleport(9683695285, Player.UserId)
end
end
local function processReceipt(receiptInfo)
local playerProductKey = receiptInfo.PlayerId .. "_" .. receiptInfo.PurchaseId
local purchased = false
local success, errorMessage = pcall(function()
purchased = purchaseHistoryStore:GetAsync(playerProductKey)
end)
if success and purchased then
return Enum.ProductPurchaseDecision.PurchaseGranted
elseif not success then
error("Data store error:" .. errorMessage)
end
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local handler = productFunctions[receiptInfo.ProductId]
local success, result = pcall(handler, receiptInfo, player)
if not success or not result then
warn("Error occurred while processing a product purchase")
print("\nProductId:", receiptInfo.ProductId)
print("\nPlayer:", player)
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local success, errorMessage = pcall(function()
purchaseHistoryStore:SetAsync(playerProductKey, true)
end)
if not success then
error("Cannot save purchase data: " .. errorMessage)
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.PromptPurchaseFinished:Connect(DeveloperProductsRecieptCompleted)
MarketplaceService.ProcessReceipt = processReceipt