game.StarterGui.ResetPlayerGuiOnSpawn = false

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 == 34697576 then
		productName = "$10,000!"
		local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
		if cashmoney then
			cashmoney.Value = cashmoney.Value + 10000
		end
	elseif productId == 34698064 then
		productName = "$100,000!"
		local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
		if cashmoney then
			cashmoney.Value = cashmoney.Value + 100000
		end
	elseif productId == 34698110 then
		productName = "1,000,000!"
		local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
		game.ReplicatedStorage.MasterKey:FireClient(player,"PurchaseConfirm")
		if cashmoney then
			cashmoney.Value = cashmoney.Value + 1000000
		end
	elseif productId == 34698190 then
		productName = "+20 Walkspeed"
		local char = player.Character
		if char then
			local human = char:FindFirstChild("Humanoid")
			if human then
				human.WalkSpeed = human.WalkSpeed + 20
			end
		end
	elseif productId == 34698440  then
		productName = "Minigun"
		game.Lighting.Minigun:Clone().Parent=player.Backpack
			end
		end
	elseif productId == 34699873  then --THE ELSEIF IS UNDERLINED RED IN THE SCRIPT
		productName = "Jetpack"
		game.Lighting.Jetpack:Clone().Parent=player.Backpack
	end
	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

2 comments

1

Above the error, it seems you have an extra end. Remove the extra end above the elseif, and you should be golden.

0

Thank you so much, I fellso stupid -_-