Me and my friend made a public tycoon the other day but there was a problem in the tycoon. We used a Tycoon kit that adds both a leaderboard and the necessities for other things to make the tycoon function. So the problem is that every time I add a menu to buy in-game money through devproducts it suddenly doesn’t work. I tried to publishing the place to another place and it works there. Besides that I also tried to put the entire tycoon kit in again with the menu (So without our self-made tycoon but with the original kit), this also worked smoothly. I have already tried to fix this several times but I cannot get to how this can be reversed. There were also previous versions of the same game where we used the same menu and devproducts handler and then it worked too.
I hope someone can help me with this
local script
local Marketplace = require(game:GetService("ReplicatedStorage").Marketplace)
for i,v in ipairs(script.Parent.Buttons:GetChildren()) do
spawn(function()
if v:isA("TextButton") then
local oldText = v.Text
v.Text = "Loading..."
wait(0.1)
v.Text = "Loading.."
if Marketplace["DevProducts"][v.Name] then
v.Name = Marketplace["DevProducts"][v.Name]
elseif Marketplace["Gamepasses"][v.Name] then
v.Name = Marketplace["Gamepasses"][v.Name]
else
v.Text = "Failed!"
return
end
wait(0.1)
v.Text = "Loading."
wait(0.1)
v.Text = "Loading.."
wait(0.1)
v.Text = "Loading..."
wait(0.2)
v.Text = "Loading."
wait(0.2)
v.Text = "Loading.."
wait(0.1)
v.Text = "Loading..."
wait(0.3)
v.Text = "Loaded!"
wait(0.1)
v.Text = "Loading."
wait(0.1)
v.Text = "Loading.."
wait(0.1)
v.Text = "Loading..."
wait(0.2)
v.Text = "Loading."
wait(0.2)
v.Text = "Loading.."
wait(0.1)
v.Text = "Loading..."
wait(0.3)
v.Text = "Loaded!"
wait(0.3)
v.Text = oldText
v.MouseButton1Click:connect(function()
pcall(function()
if v:FindFirstChild("Pass") then
game.MarketplaceService:PromptPurchase(game.Players.LocalPlayer,tonumber(v.Name))
else
game.MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer,tonumber(v.Name))
end
end)
end)
end
end)
end
DevProduct Handler:
game.StarterGui.ResetPlayerGuiOnSpawn = false
old_fog = game.Lighting.FogStart
local MarketplaceService = game:GetService("MarketplaceService")
function getPlayerFromId(id)
for i,v in pairs(game.Players:GetChildren()) do
if v.userId == id then
return v
end
end
return nil
end
local Marketplace = require(game:GetService("ReplicatedStorage").Marketplace)
local Products = Marketplace["DevProducts"]
MarketplaceService.ProcessReceipt = function(receiptInfo)
print("Purchase")
local productId = receiptInfo.ProductId
local playerId = receiptInfo.PlayerId
local player = getPlayerFromId(playerId)
if productId == Products["Speed Coil"] then
game.ServerStorage["Speed Coil"]:Clone().Parent=player.Backpack
elseif productId == Products["1000"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 1000
end
elseif productId == Products["5000"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 5000
end
elseif productId == Products["10000"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 10000
end
elseif productId == Products["25000"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 25000
end
elseif productId == Products["50000"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 50000
end
elseif productId == Products["Unlimited Cash"] then
local Cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if Cash then
Cash.Value = Cash.Value + 999999999
end
-------------------------------------------------------------------
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end