如何在roblox中完美制作开发者产品?
How to perfectly make developer products in roblox?
我一直在学习制作 roblox 游戏,但最近我遇到了一个问题,代码是正确的,但它不起作用。
我正在按照这个 roblox website.
但即使我做了类似的事情,它也不起作用。谁能纠正我哪里错了?
local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local donateEvent = ReplicatedStorage:WaitForChild("donateEvent")
local ProductFunctions = {}
ProductFunctions[1249752191] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752535] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752534] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752537] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752533] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752530] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752532] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752536] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752531] = function(Player)
donateEvent:FireClient(Player)
end
MarketPlaceService.ProcessReceipt = function(info)
local Player = Players:GetPlayerByUserId(info.PlayerId)
local Product = info.PurchaseId
if not Player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local success, err = pcall(ProductFunctions[Product],Player)
if not success then
warn('error')
return Enum.ProductPurchaseDecision.NotProcessedYet
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
我的问题是,即使流程收据存在并且 ID 与要检查的给定值完全匹配。函数内的事件根本不会触发!所有事件中甚至没有触发 1 个事件...
问题是我写的
local Product = info.PurchaseId
其实应该是
local Product = info.ProductId
我一直在学习制作 roblox 游戏,但最近我遇到了一个问题,代码是正确的,但它不起作用。
我正在按照这个 roblox website.
但即使我做了类似的事情,它也不起作用。谁能纠正我哪里错了?
local MarketPlaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local donateEvent = ReplicatedStorage:WaitForChild("donateEvent")
local ProductFunctions = {}
ProductFunctions[1249752191] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752535] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752534] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752537] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752533] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752530] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752532] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752536] = function(Player)
donateEvent:FireClient(Player)
end
ProductFunctions[1249752531] = function(Player)
donateEvent:FireClient(Player)
end
MarketPlaceService.ProcessReceipt = function(info)
local Player = Players:GetPlayerByUserId(info.PlayerId)
local Product = info.PurchaseId
if not Player then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local success, err = pcall(ProductFunctions[Product],Player)
if not success then
warn('error')
return Enum.ProductPurchaseDecision.NotProcessedYet
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
我的问题是,即使流程收据存在并且 ID 与要检查的给定值完全匹配。函数内的事件根本不会触发!所有事件中甚至没有触发 1 个事件...
问题是我写的
local Product = info.PurchaseId
其实应该是
local Product = info.ProductId