So, when this button is clicked, it is supposed to prompt the purchase of a Developer Product, and if it is purchased, it needs to change the Visible property of two GUIs. But when I click it, it doesn't do anything. Could you please tell me why it doesn't work? ******Note: I got this script for someone else, I don't really think it looks right, but I'm new at scripting.

local button = script.Parent
local Market = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local id = 22279983
local results = game.Players.LocalPlayer.PlayerGui.ScreenGui.results
local loading = button.Parent 

button.MouseButton1Down:connect(function()
  Market:PromptProductPurchase(player, id)
end)
 
function (onPurchaseFinished(player, id, isPurchased)
	loading.Visible = false
	results.Visible = true
	
end