Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gamepass Prompt Purchase Script Not Firing?

This script is used in a text Button on a surfacegui but when it is clicked, nothing happens.

local id = 605471096
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function()
	game:GetService("MarketplaceService"):PromptPurchase(plr, id)
end)

4 comments

1

LocalPlayer only works in local scripts.

0

Put print("Running") at the top of the script and see if it is running.

0

Except that it's in a SurfaceGui.

0

it is a local script

1 answer

✓ Accepted answer

LocalScripts don't run in Workspace, since the server is unable to identify which client(s) to run them on. Move the code to a server script and find a different way to identify the player.

This discussion is preserved as it was. New answers, comments, and votes are closed.