Well it’s slightly different then the title says, because it dosnt work in team create even on my own, only works when testing.
I need the player to freeze every 10 minutes (60 seconds for the example) and I hvae these three scripts:
In serverscriptservice:
local DevP1 = 1266365674
local MS = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
local char = player.CharacterAdded:Wait()
while wait(60) do
char.Humanoid.WalkSpeed = 0
MS:PromptProductPurchase(player,DevP1)
end
end)
game.Players.PlayerAdded:Connect(function(plr)
wait(10)
local char = plr.CharacterAdded:Wait()
char.Humanoid.WalkSpeed = 0
MS:PromptProductPurchase(plr,DevP1)
end)
also in serverscriptservice:
local MarketplaceService = game:GetService("MarketplaceService")
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local purchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory")
local productFunctions = {}
productFunctions[1266365674] = function(receipt, player)
player.Character.Humanoid.WalkSpeed = 16
return true
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.ProcessReceipt = processReceipt
Anyone see the problem? I am committing, publishing and everything!