Title
gamepassid = 931935266 local player = game.Players.LocalPlayer local marketplaceService = game:GetService("MarketplaceService") function onClicked(playerWhoClicked) marketplaceService:PromptPurchase(player, gamepassid) end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Your problem is that this is a LocalScript running on the server.
You defined the parameter "playerWhoClicked", yet tried to use the "player" variable. You cannot index the localplayer from the server.
Simply use the playerWhoClicked variable. And make sure this is a Script object.
local marketplaceService = game:GetService("MarketplaceService") local gamepassid = 931935266 function onClicked(playerWhoClicked) marketplaceService:PromptPurchase(playerWhoClicked, gamepassid) end script.Parent.ClickDetector.MouseClick:connect(onClicked)