I'm making a tycoon and I want to make dev products to help with speed, cash, and health. Here's what I did.


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

MarketplaceService.ProcessReceipt = function(receiptInfo) local productId = receiptInfo.ProductId local playerId = receiptInfo.PlayerId local player = getPlayerFromId(playerId) local productName

-- Down below is an example of a Cash boost

-------------------------------------------------------------------

if productId == 310891759 then
	local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
		if cashmoney then
			cashmoney.Value = cashmoney.Value + 50000
		end
		
		
		
	elseif productId == 310891034 then
	local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
		if cashmoney then
			cashmoney.Value = cashmoney.Value + 100000
		end
	-------------------------------------------------------------------

	-- Down below is an example of a Health boost
	
	-------------------------------------------------------------------

	elseif productId == 310891759 then
	local char = player.Character
	char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 20
	wait()
	char.Humanoid.Health = char.Humanoid.MaxHealth
	-------------------------------------------------------------------

	-- Down below is an example of a WalkSpeed boost

	-------------------------------------------------------------------
	elseif productId == 310892411 then
	local char = player.Character
	if char then
		local human = char:FindFirstChild("Humanoid")
		if human then
			human.WalkSpeed = human.WalkSpeed + 5
		end
	end
	
	
	
	elseif productId == 310892160 then
	local char = player.Character
	if char then
		local human = char:FindFirstChild("Humanoid")
		if human then
			human.WalkSpeed = human.WalkSpeed + 10
		end
	end
	-------------------------------------------------------------------
	
	-- Down below is an example of a gear giver
	
	-------------------------------------------------------------------
	
	elseif productId == 310892411 then
	game.ServerStorage.GodlySword:Clone().Parent=player.Backpack
	
	-------------------------------------------------------------------
end
return Enum.ProductPurchaseDecision.PurchaseGranted		

end


But when I do a test purchase, it doesn't work. Help?

3 comments

1

Looks like a free model script to me. I can tell from the comments and deprecated code.

0

Yea, it was from Zed's Tycoon Kit.

0

Well, you passed it on as your code. That’s plagiarism.