Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am trying to make a GUI Button that will prompt a purchase but it dosen't work?

local player = game.Players.PlayerAdded:connect(function(player)
	
end)
---
script.Parent.MouseButton1Click:connect(function(Click)
	

local productId = 33200957

	game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

This is what i get in the output 11:42:30.871 - MarketplaceService:PromptProductPurchase() player should be of type Player, but is of type nil

1 answer

You've set player to a function value, it needs to be the player. If this is in a local script use player = game.Players.LocalPlayer. If it isn't please comment on this and I'll try and help you, your problem is just that it's trying to prompt a function, not a player.

This discussion is preserved as it was. New answers, comments, and votes are closed.