Hey there, I am trying to use PromptProductPurchase
so people can buy my product. However, I have to work my way around using RemoteEvents
but when I click the button nothing happens. I have parts of my scripts that may help solve the problem.
Event handler (Script)
local function onPurchasePrompt(player, button)
local MarketplaceService = game:GetService("MarketplaceService")
local scrollingframe = game.StarterGui.BuyMoreCharacters.MainFrame.ScrollingFrame
local tiny = 1297667732
local small = 1297667556
local medium = 1297667557
local large = 1297669211
local verylarge = 1297669603
local extremelylarge = 1297670063
local largest = 1297670613
local tinybutton = scrollingframe.TinyPurchase
local smallbutton = scrollingframe.SmallPurchase
local mediumbutton = scrollingframe.MediumPurchase
local largebutton = scrollingframe.LargePurchase
local verylargebutton = scrollingframe.VeryLargePurchase
local extremelylargebutton = scrollingframe.ExtremelyLargePurchase
local largestbutton = scrollingframe.LargestPurchase
if button == tinybutton then
MarketplaceService:PromptProductPurchase(player, tiny)
elseif button == smallbutton then
MarketplaceService:PromptProductPurchase(player, small)
elseif button == mediumbutton then
MarketplaceService:PromptProductPurchase(player, medium)
elseif button == largebutton then
MarketplaceService:PromptProductPurchase(player, large)
elseif button == verylargebutton then
MarketplaceService:PromptProductPurchase(player, verylarge)
elseif button == extremelylargebutton then
MarketplaceService:PromptProductPurchase(player, extremelylarge)
elseif button == largestbutton then
MarketplaceService:PromptProductPurchase(player, largest)
end
end
game:GetService("ReplicatedStorage").PurchaseCharacters.OnServerEvent:Connect(onPurchasePrompt)
Click button (LocalScript)
local button = script.Parent
local rep = game:GetService("ReplicatedStorage")
button.MouseButton1Click:Connect(function()
rep.PurchaseCharacters:FireServer(button)
end)
Keep in mind this is in every button