Script doesnt show an error on the output, knor would it show up in-game

Hello. My script wont show on the output, knor it wouldnt work! I dont know whats going on as its probably a error with my script. Check it out:

local mps = game:GetService("MarketplaceService")
local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function()
	mps.ProcessReceipt = function(purchaseInfo)
		local plr = game:getService("Players"):GetPlayedByUserId(purchaseInfo.PlayerId)
		if purchaseInfo.ProductID == 1164763860 then

			print("Test")

		elseif purchaseInfo.ProductId == 1164763860 then
			
		    print("Test.")

		end

	end

end)

If there is anything wrong with my script, please let me know

1 Like

Mistypo? Change that to:

local plr = game:GetService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)

Even so, I fixed that. Still wouldnt show on the output knor in-game.

Could you try this then?

local mps = game:GetService("MarketplaceService")
local ProximityPrompt = script.Parent

ProximityPrompt.Triggered:Connect(function()
    print("Triggered Prompt")
	mps.ProcessReceipt = function(purchaseInfo)
        print("Processing receipt")
		local plr = game:getService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)
		if purchaseInfo.ProductId == 1164763860 then
			print("Test")
		elseif purchaseInfo.ProductId == 1164763860 then
		    print("Test.")
        else
            print("Not a valid Product ID?")
		end
	end
end)

It did print something on the output (“triggered prompt”) however prompt didnt appear, do I need to enable anything?/do prompts only appear in-game?

Try disabling RequiresLineOfSight in the ProximityPrompt properties.

Was already disabled in the first place.

Put the

mps.ProcessReceipt = function(purchaseInfo)
		local plr = game:getService("Players"):GetPlayedByUserId(purchaseInfo.PlayerId)
		if purchaseInfo.ProductID == 1164763860 then

			print("Test")

		elseif purchaseInfo.ProductId == 1164763860 then
			
		    print("Test.")

		end

	end

In a server script, and make sure it’s not inside the ProximityPrompt Event.

How will the prompt be activated then?

(e.x: click a button to prompt the purchase.)

Use prompt product purchase inside the event

Doesnt that require a local script? Proximity prompt cant go into a local script.