Do we have anywhere a Script Template for a Purchase Button on a Part with ClickDetector?
For an
- Item Purchase
- Game Pass Purchase
That would be sooo helpful.
Thank you so much for any little help,
appreciate it!
Do we have anywhere a Script Template for a Purchase Button on a Part with ClickDetector?
For an
That would be sooo helpful.
Thank you so much for any little help,
appreciate it!
Godzilla had a stroke reading this. (only kidding lol) but fr what do you mean. A gamepass that pops up when a gui is clicked or smth else.
Found this on the Official Documentation:
Local Script (Client):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local promptPurchaseEvent = ReplicatedStorage:WaitForChild("PromptPurchaseEvent")
local part = Instance.new("Part")
part.Parent = workspace
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = part
clickDetector.MouseClick:Connect(function()
promptPurchaseEvent:FireServer(16630147)
end)
Script (Server):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local promptPurchaseEvent = Instance.new("RemoteEvent")
promptPurchaseEvent.Name = "PromptPurchaseEvent"
promptPurchaseEvent.Parent = ReplicatedStorage
-- Listen for the RemoteEvent to fire from a Client and then trigger the purchase prompt
promptPurchaseEvent.OnServerEvent:Connect(function(player, id)
MarketplaceService:PromptPurchase(player, id) -- If gamepass specifically then use PromptGamePassPurchase, if developer product specifically then use PromptProductPurchase
end)