local MarketplaceService = game:GetService("MarketplaceService")
local Player = game:GetService("Players").LocalPlayer
local GamepassId = 141279747
local HasPass = false
local Button = script.Parent
local function UpdateHasPass()
local success, message = pcall(function()
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId)
end)
if success and HasPass then
if HasPass == true then
Button.Owned.Visible = true
end
end
end
Button.MouseButton1Click:Connect(function()
if HasPass == true then
Button.Owned.Visible = true
print("Already has it")
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassId)
end
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function()
UpdateHasPass()
end)
UpdateHasPass()
The mousebutton1click function does not pass a player.