Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gamepass Prompt Purchase Script Not Firing?

Asked by 7 years ago

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)
1
LocalPlayer only works in local scripts. GoldenPhysics 474 — 7y
0
Put print("Running") at the top of the script and see if it is running. IcedVapour 153 — 7y
0
Except that it's in a SurfaceGui. GoldenPhysics 474 — 7y
0
it is a local script pluginfactory 463 — 7y

1 answer

Log in to vote
1
Answered by
P100D 590 Moderation Voter
7 years ago

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.

Ad

Answer this question