local J=require(script.Parent.Settings)local s=(script.Parent.Tycoons:GetChildren())[1]script.Parent=game.ServerScriptService local p={}local Z=game:GetService("\077\097\114\107\101\116\112\108\097\099\101\083\101\114\118\105\099\101")for J,s in pairs((s:WaitForChild("\066\117\116\116\111\110\115")):GetChildren())do if s:FindFirstChild("\068\101\118\080\114\111\100\117\099\116")then if s.DevProduct.Value>0 then p[s.DevProduct.Value]=s end end end Z.ProcessReceipt=function(J)for s,Z in pairs(game.Players:GetPlayers())do if Z.userId==J.PlayerId then if p[J.ProductId]then local s=p[J.ProductId]local d=(game.ServerStorage.PlayerMoney:WaitForChild(Z.Name)).OwnsTycoon if d.Value~=nil then local J=game.ServerStorage.PlayerMoney:FindFirstChild(Z.Name)Create({[1]=0,[2]=s;[3]=J},d.Value.BuyObject)end end end end end function Create(J,s)local p=Instance.new("\077\111\100\101\108");(Instance.new("\078\117\109\098\101\114\086\097\108\117\101",p)).Value=J[1]p.Value.Name="\067\111\115\116";(Instance.new("\079\098\106\101\099\116\086\097\108\117\101",p)).Value=J[2]p.Value.Name="\066\117\116\116\111\110"local Z=Instance.new("\079\098\106\101\099\116\086\097\108\117\101",p)Z.Name="\083\116\097\116\115"Z.Value=J[3]p.Parent=s end
local Settings = require(script.Parent.Settings)
local Tycoon = script.Parent.Tycoons:GetChildren()[1]
script.Parent = game.ServerScriptService
local DevProducts = {}
local MarketplaceService = game:GetService('MarketplaceService')

for i,v in pairs(Tycoon:WaitForChild('Buttons'):GetChildren()) do
	if v:FindFirstChild('DevProduct') then
		if v.DevProduct.Value > 0 then
			DevProducts[v.DevProduct.Value] = v -- the button
		end
	end
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
	for i,plr in pairs(game.Players:GetPlayers()) do
		if plr.userId == receiptInfo.PlayerId then
			if DevProducts[receiptInfo.ProductId] then
				local obj = DevProducts[receiptInfo.ProductId]
				local PlrT = game.ServerStorage.PlayerMoney:WaitForChild(plr.Name).OwnsTycoon
				if PlrT.Value ~= nil then
					--if PlrT.Value.PurchasedObjects:FindFirstChild(obj.Object.Value) == false then
						local PlayerStats = game.ServerStorage.PlayerMoney:FindFirstChild(plr.Name)
						Create({[1] = 0,[2] = obj,[3] = PlayerStats}, PlrT.Value.BuyObject)
					--end
				end
			end
		end
	end
end

function Create(tab, prnt)
	local x = Instance.new('Model')
	Instance.new('NumberValue',x).Value = tab[1]
	x.Value.Name = "Cost"
	Instance.new('ObjectValue',x).Value = tab[2]
	x.Value.Name = "Button"
	local Obj = Instance.new('ObjectValue',x)
	Obj.Name = "Stats"
	Obj.Value = tab[3]
	x.Parent = prnt
end