The clicked function works and passes the correct player. It errors when it does: PromptPurchase. I've tried game.Players[player.Name] and game.Players.player. The error is "player is not a valid member of Players" I'm sure this is a blonde moment, but any help is greatly appreciated.
dialog = script.Parent.Parent
local Market = game:GetService("MarketplaceService")
local id = 20148609
print("hi from npc")
function clicked(player, dialogChoice)
print(player)
playerid = game.Players.player.Name
print("clicked from npc")
if dialogChoice.Name == "promptBuy" then
print("Dialog is working...")
Market:PromptProductPurchase(game.Players[player], id)
end
end
script.Parent.DialogChoiceSelected:connect(clicked)
