Greetings, Scripting Helpers community. I have an issue with making a GUI that, when clicked, asks the player if they want to buy a certain Game Pass. Sorry for being such a moron but I just don't know what's wrong. I'm a beginner when it comes to scripting.
local passID = 466868120
script.Parent.MouseButton1Down:connect(function(player)
game:GetService("MarketplaceService"):PromptPurchase(player, passID)
end)
The code is inside a regular script. The error is on line 4: "Unable to cast value to Object". Thank you .
Edit: All I had to do is to change the fourth line:
game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, passID)
