What do you want to achieve? I want the GUI to appear 30 seconds after the developer product was bought. It should always do this.
What is the issue? The GUI doesnt appear after buying a developer product about 1-3 times then it will never appear again in a single session.
What solutions have you tried so far? I looked on devforums, I found nothing. I also checked my folders in my explorer and haven’t found anything that could be making this issue. I even tried with AI.
Ask questions if you need more information.
local button = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = replicatedStorage:WaitForChild("RemoteEvent")
local productidd = 1839490031
button.Visible = false
local function handleButtonVisibility()
while true do
local duplicants = game.Workspace.duplicants:GetChildren()
local foundPart = false
for _, child in ipairs(duplicants) do
if child.Name == "Part" then
foundPart = true
break
end
end
if foundPart then
task.wait(8)
button.Visible = true
break
end
wait(0.1)
end
end
handleButtonVisibility()
button.MouseButton1Click:Connect(function()
button.Visible = false
game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productidd)
end)
game:GetService("MarketplaceService").PromptProductPurchaseFinished:Connect(function(player, produid, waspurch)
if produid == productidd then
if waspurch then
remoteEvent:FireServer()
else
button.Visible = true
end
end
end)
task.wait(30)
button.Visible = true
Can we see the code that receives the OnServerEvent?
There’s also quite a few things wrong with this; for starters you are using PromptProductPurchaseFinished (which should not be used for product processing) and you are doing it on the client and connecting it to a remote. This makes it extremely vulnerable to exploiters. Instead, you should use MarketplaceService.ProcessReceipt on the server to handle all dev product purchases.
I’m new at this I probably got it wrong but this was the error I got with “processreceipt”
20:48:14.819 ProcessReceipt is a callback member of MarketplaceService; you can only set the callback value, get is not available - Client - LocalScript:29
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local button = script.Parent
local duplicants = workspace:WaitForChild("duplicants")
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")
button.Visible = false
duplicants.ChildAdded:Connect(function(part)
if part:IsA("Part") then
task.wait(8)
button.Visible = true
end
end)
button.MouseButton1Click:Connect(function()
local productId = 1839490031
MarketplaceService:PromptProductPurchase(Players.LocalPlayer, productId)
button.Visible = false
end)
MarketplaceService.PromptProductPurchaseFinished:Connect(function(userId, productId, isPurchased)
if isPurchased then
remoteEvent:FireServer()
-- after it was purchased, the button will reappear after 30 seconds.
task.wait(30)
button.Visible = true
else
button.Visible = true
end
end)