Robux 轉移

*此內容是使用 AI(Beta 測試版)翻譯,可能含有錯誤。若要以英文檢視此頁面,請按一下這裡

Robux 轉移Roblox Plus 訂閱者可以直接將 Robux 發送給其他用戶。

要在您的遊戲中支持轉移,請調用 PromptRobuxTransferAsync 來打開轉移提示,並使用 BindReceiptHandler 來處理轉移收據。當訂閱者完成轉移時,您的遊戲將獲得發送的 Robux 的 10%,而接收者將獲得其餘的 90%。例如,100 Robux 的轉移將支付給接收者 90 Robux,並支付給您的遊戲 10 Robux。

您的遊戲從轉移中獲得的 Robux 符合 DevEx 計劃。Roblox 不會對這些轉移收取費用。

作為創作者,您無法訪問轉移詳細信息或控制執行。所有 Robux 轉移均由 Roblox 平台處理和管理,所有發送者和接收者的行為都經過相同的安全性和合格性檢查。在您的遊戲中,轉移通過 Roblox 控制的 UI 來完成,以確保安全和符合政策。

提示 Robux 轉移

要在您的遊戲中啟動 Robux 轉移:

  1. 從伺服器端腳本調用 PromptRobuxTransferAsync
  2. 傳遞所需的參數:
    • sender: 發起轉移的玩家。
    • receiverUserId: 接收者的用戶 ID。
    • amount: 要轉移的 Robux 金額。
  3. 儲存返回的 transferRequestId,它用於識別轉移請求,並可用於稍後記錄或關聯轉移與收據。

以下示例在兩個用戶之間啟動 Robux 轉移:


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
-- 當用戶觸發 RemoteEvent 時轉移 Robux
local transferEvent = game.ReplicatedStorage:WaitForChild("RequestTransfer")
transferEvent.OnServerEvent:Connect(function(sender, receiverUserId, amount)
-- 驗證輸入
if not sender or not sender:IsA("Player") then
return
end
if typeof(receiverUserId) ~= "number" or receiverUserId <= 0 then
warn("無效的 receiverUserId")
return
end
if typeof(amount) ~= "number" or amount <= 0 then
warn("無效的金額")
return
end
local success, result = pcall(function()
return MarketplaceService:PromptRobuxTransferAsync(sender, receiverUserId, amount)
end)
if success then
print(`轉移已啟動,轉移請求 ID: {result}`)
else
warn(`轉移失敗: {result}`)
end
end)

處理轉移收據

成功轉移後,Roblox 會為發送者和接收者生成收據。您可以使用 BindReceiptHandler 來處理這些收據,以確認轉移是否成功完成。

要鼓勵 Plus 訂閱者在您的遊戲中轉移 Robux,您可以為每個成功轉移提供物品或其他福利。如果這樣做,請在授予獎勵之前處理收據,以確保它僅在完成的轉移中給予。

要處理 Robux 轉移收據:

  1. 使用 BindReceiptHandler 註冊處理程序 RobuxTransferSender,該處理程序處理發起轉移的用戶的收據。
  2. 註冊第二個處理程序 RobuxTransferReceiver,該處理程序處理接收 Robux 的用戶的收據。
  3. 在每個處理程序中,檢查收據信息,包括 PlayerIdTransferRequestId。兩種類型的收據均包括與 PromptRobuxTransferAsync 返回的 transferRequestId 匹配的 TransferRequestId
  4. 從處理程序返回 Enum.ReceiptDecision 的值:
    • 在完成收據處理後返回 Processed。這將該收據標記為已完成並確認 Robux 轉移成功。
    • 如果收據尚無法處理,則返回 NotProcessedYet(例如,如果用戶不再在伺服器上)。這將保持收據未解決,以便稍後交付(例如,當用戶重新加入伺服器時)。

以下示例為發送者和接收者收據註冊處理程序:


local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
-- 處理發送者收據(發送 Robux 的用戶)
local senderConnection = MarketplaceService:BindReceiptHandler(
Enum.ReceiptType.RobuxTransferSender,
function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
-- 用戶離開了伺服器 - 收據處理將推遲,直到用戶重新加入伺服器
return Enum.ReceiptDecision.NotProcessedYet
end
print(`{player.Name} 發送了 Robux (轉移請求 ID: {receiptInfo.TransferRequestId})`)
-- 您可以在這裡授予任何發送者方面的確認或更新 UI
return Enum.ReceiptDecision.Processed
end
)
-- 處理接收者收據(接收 Robux 的用戶)
local receiverConnection = MarketplaceService:BindReceiptHandler(
Enum.ReceiptType.RobuxTransferReceiver,
function(receiptInfo)
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
return Enum.ReceiptDecision.NotProcessedYet
end
print(`{player.Name} 收到了 Robux (轉移請求 ID: {receiptInfo.TransferRequestId})`)
-- 您可以在這裡授予任何接收者方面的福利或更新 UI
return Enum.ReceiptDecision.Processed
end
)
©2026 Roblox Corporation、Roblox、Roblox 標誌及 Powering Imagination 是我們在美國及其他國家地區的部分註冊與未註冊商標。