This script:
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
And this script:
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
MarketplaceService.ProcessReceipt = function(receiptInfo)
local productId = receiptInfo.ProductId
local playerId = receiptInfo.PlayerId
local player = getPlayerFromId(playerId)
local productName
if productId == 51151679 then
productName = "$25,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 25000
end
elseif productId == 51151684 then
productName = "$50,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 50000
end
elseif productId == 51151691 then
productName = "$75,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 75000
end
elseif productId == 51151723 then
productName = "$100,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 100000
end
elseif productId == 51151734 then
productName = "$250,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 250000
end
elseif productId == 51151739 then
productName = "$500,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 500000
end
elseif productId == 51151758 then
productName = "$750,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 750000
end
elseif productId == 51151788 then
productName = "$1,000,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 1000000
end
elseif productId == 51151814 then
productName = "$5,000,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 5000000
end
elseif productId == 51151827 then
productName = "$10,000,000"
local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
if cashmoney then
cashmoney.Value = cashmoney.Value + 10000000
end
elseif productId == 51152591 then
productName = "10 Walkspeed"
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = human.WalkSpeed + 10
end
end
elseif productId == 51153173 then
productName = "30 Walkspeed"
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = human.WalkSpeed + 30
end
end
elseif productId == 51153297 then
productName = "50 Health"
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.MaxHealth = human.MaxHealth + 50
human.Health = human.Health + 50
end
end
elseif productId == 51153323 then
productName = "100 Health"
local char = player.Character
if char then
local human = char:FindFirstChild("Humanoid")
if human then
human.MaxHealth = human.MaxHealth + 100
human.Health = human.Health + 100
end
end
elseif productId == 51218774 then
productName = "Gravity Coil"
game.ServerStorage.GravityCoil:Clone().Parent=player.Backpack
elseif productId == 51218787 then
productName = "Speed Coil"
game.ServerStorage.SpeedCoil:Clone().Parent=player.Backpack
elseif productId == 51218807 then
productName = "Hyperbike"
game.ServerStorage.Hyperbike:Clone().Parent=player.Backpack
elseif productId == 51218820 then
productName = "Magic Carpet"
game.ServerStorage.MagicCarpet:Clone().Parent=player.Backpack
elseif productId == 51218835 then
productName = "Godly Sword"
game.ServerStorage.GodlySword:Clone().Parent=player.Backpack
elseif productId == 51218847 then
productName = "Pet Dragon"
game.ServerStorage.PetDragon:Clone().Parent=player.Backpack
elseif productId == 51218865 then
productName = "Laser Gun"
game.ServerStorage.LaserGun:Clone().Parent=player.Backpack
elseif productId == 51218873 then
productName = "Gold Radio"
game.ServerStorage.GoldRadio:Clone().Parent=player.Backpack
elseif productId == 51218882 then
productName = "Jetpack"
game.ServerStorage.Jetpack:Clone().Parent=player.Backpack
elseif productId == 51218900 then
productName = "Helicopter"
game.ServerStorage.Helicopter:Clone().Parent=player.Backpack
elseif productId == 51218925 then
productName = "UNLIMITED CASH"
print("you got scammed")
elseif productId == 51218931 then
productName = "ADMIN"
print("you got scammed")
end
game.BadgeService:AwardBadge(0)
local message = Instance.new("Hint",workspace)
message.Text = player.Name.." purchased "..productName.."!"
coroutine.resume(coroutine.create(function()
wait(2)
message:destroy()
end))
return Enum.ProductPurchaseDecision.PurchaseGranted
end
But I have no idea how since they're two different scripts, help?
