Why wont this script prompt a purchase?

Why won’t this script prompt a purchase?

It’s in a local script because I only want it to happen for one player.

local BeachHouseBuyButton = script.Parent.BeachButton
local MarketPlaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local gamepassid = 24133844

BeachHouseBuyButton.MouseButton1Click:Connect(function()
	MarketPlaceService:PromptGamePassPurchase(player.UserId, gamepassid)
end)
1 Like

Try removing .UserId after player.

It says you have to pass the player instance and not ID

image

3 Likes