So, I was testing gamepass purchase prompt for my game, but when I click, it says this error:
I know they’re public because 4 people have already bought it, but it still says this in Roblox.
Here is the local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local slap = ReplicatedStorage:WaitForChild("GamepassEvents"):WaitForChild("slap") -- Wait until the RemoteEvent exists, since it is being created by the Server
-- Create a part on the client that triggers our slap clicked
local slapclick = game.Workspace.prchsgp.SlapOut.ClickDetector
-- When the ClickDetector is clicked by the player, fire an event to the Server
slapclick.MouseClick:Connect(function()
slap:FireServer(23171784) -- Pass in an ID
end)
----------------------------------------------------------------------------
local slap = ReplicatedStorage:WaitForChild("GamepassEvents"):WaitForChild("Burning") -- Wait until the RemoteEvent exists, since it is being created by the Server
-- Create a part on the client that triggers our slap clicked
local slapclick = game.Workspace.prchsgp.BunringHOuse.ClickDetector
-- When the ClickDetector is clicked by the player, fire an event to the Server
slapclick.MouseClick:Connect(function()
slap:FireServer(23108485) -- Pass in an ID
end)
Here is the server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
-- Setup RemoteEvent in ReplicatedStorage
local slap = game.ReplicatedStorage:WaitForChild("GamepassEvents"):WaitForChild("slap")
-- Listen for the RemoteEvent to fire from a Client and then trigger the purchase prompt
slap.OnServerEvent:Connect(function(player, id)
MarketplaceService:PromptPurchase(player, id)
end)
-----------------------------------------------------------------------------------
-- Setup RemoteEvent in ReplicatedStorage
local burn = game.ReplicatedStorage:WaitForChild("GamepassEvents"):WaitForChild("Burning")
-- Listen for the RemoteEvent to fire from a Client and then trigger the purchase prompt
burn.OnServerEvent:Connect(function(player, id)
MarketplaceService:PromptPurchase(player, id)
end)