Roblox Studio error

PromptProductPurchase called from a local script, but not called on a local player

What PromptProductPurchase called from a local script, but not called on a local player means in Roblox Studio, the two things that cause it with the code that triggers each, and the fix for each one.

Updated 12 November 20263 min readErrorLuauWritten by

In short

A LocalScript can only show a purchase prompt to its own player. If the first argument of PromptProductPurchase is any other player, or not a player at all, you get this error and no prompt. Pass Players.LocalPlayer. If the purchase starts from something in the world, like a pad another player can touch, prompt from a server Script instead, which can prompt anyone.

On this page
  1. What it means
  2. Causes and fixes
  3. Fix it with RoCode
  4. Find the line
  5. Questions
  6. Sources

What the message means

Output (example)
MarketplaceService:PromptProductPurchase called from a local script, but not called on a local player. Local scripts can only prompt the local player.

Every client runs its own copy of a LocalScript. A Touched event in a LocalScript fires for every character that touches the part, not only yours, so the player you get from it is often someone else.

The same rule applies to PromptGamePassPurchase and the other prompt methods.

Causes and fixes

Two things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.

A touch pad in a LocalScript prompts whoever touched it

When another player steps on the pad, your client also sees the touch and tries to prompt them.

Breaks LocalScript in StarterPlayer.StarterPlayerScripts named BuyPad
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local PRODUCT_ID = 123456789
local pad = workspace:WaitForChild("BuyPad") :: BasePart

pad.Touched:Connect(function(hit)
    local player = Players:GetPlayerFromCharacter(hit.Parent)
    if player then
        MarketplaceService:PromptProductPurchase(player, PRODUCT_ID)
    end
end)

Only prompt when the toucher is the local player.

Fixed LocalScript in StarterPlayer.StarterPlayerScripts named BuyPad
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local PRODUCT_ID = 123456789
local localPlayer = Players.LocalPlayer
local pad = workspace:WaitForChild("BuyPad") :: BasePart

local debounce = false
pad.Touched:Connect(function(hit: BasePart)
    local character = hit:FindFirstAncestorOfClass("Model")
    local player = character and Players:GetPlayerFromCharacter(character)
    if player ~= localPlayer or debounce then
        return
    end
    debounce = true
    MarketplaceService:PromptProductPurchase(localPlayer, PRODUCT_ID)
    task.wait(2)
    debounce = false
end)

The first argument is not the player

Passing the character, a button or a user ID instead of the Player object counts as "not the local player" too.

Breaks LocalScript in a TextButton in StarterGui named BuyButton
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local button = script.Parent :: TextButton
button.Activated:Connect(function()
    -- the character is not a Player
    MarketplaceService:PromptProductPurchase(Players.LocalPlayer.Character, 123456789)
end)

Pass the Player object itself.

Fixed LocalScript in a TextButton in StarterGui named BuyButton
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local PRODUCT_ID = 123456789
local button = script.Parent :: TextButton
button.Activated:Connect(function()
    MarketplaceService:PromptProductPurchase(Players.LocalPlayer, PRODUCT_ID)
end)

The prompt only asks. Give the item in MarketplaceService.ProcessReceipt on the server, never from the LocalScript.

Fix it in your place

Paste the error, RoCode fixes it in your place

Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.

For example: MarketplaceService:PromptProductPurchase called from a local script, but not called on a local player. Local scripts can only prompt the local player.

RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.

How to find the line that causes it

  1. Open Output (Window menu, or the Script tab), clear it with Ctrl+K (⌘K on Mac), and press Play.
  2. Find the first red line. It starts with the script's place in the Explorer and the line number, such as ServerScriptService.Shop:12:.
  3. Click the red line. Studio opens that script with the cursor on the failing line.
  4. Read the lines between Stack Begin and Stack End under it: they list the calls that led there, newest first, so you can see which function called the broken one.
  5. Still not sure which value is wrong? Add print(typeof(x), x) just above the line, or set a breakpoint on it and read the values in the Watch window.

Questions

Can the server prompt a purchase?

Yes. A server Script can call PromptProductPurchase(player, id) for any player in the server, which suits pads and NPCs.

Where do I give the item after the purchase?

In MarketplaceService.ProcessReceipt, set in one server Script. It runs only when Roblox confirms the payment.

Does this happen for game passes too?

Yes, with PromptGamePassPurchase: a LocalScript can only prompt its own player.

Can RoCode fix it?

Yes. Paste the Output line into RoCode. It fixes the prompt in your open place and checks that ProcessReceipt gives the item on the server.

Sources and further reading

How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 12 November 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked against the strings in Roblox Studio itself (macOS build installed on 12 November 2026) on 12 November 2026. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.

More Roblox errors

All Roblox Studio errors

Stop hunting errors line by line.

RoCode reads the scripts in your open place, fixes the error where it happens and tells you what it changed. Free every day, no card required.