I want the player to be able to buy a gamepass for the core in my game
The thing is that when the player clicks on the button to buy a gamepass, an error appears
So far, no action has been taken to resolve this issue.
Here is the code that is used to try to purchase a gamepass (client script)
``
local rem2 = game.ReplicatedStorage:WaitForChild("CoreTipi2")
local marketplaceservice = game:GetService("MarketplaceService")
rem2.OnClientEvent:Connect(function(id)
local player = game.Players.LocalPlayer local success, message = pcall(function()
marketplaceservice:PromptPurchase(player, id) end)
if not success then
warn("Failed to prompt purchase: " .. message) -- Optionally, notify the player of the failure
end
end)