So I have a script where it checks to see if the user owns a gamepass, if they do it prints their name, If they don't it prints "user name doesn't own gamepass".
local id = 5179136
script.Parent.MouseClick:Connect(function(player)
game.MarketplaceService:PromptGamePassPurchase(player, id)
if game:GetService("MarketplaceService"):UserOwnsAsset(player, id) == true
then print(player.Name)
end
if game:GetService("MarketplaceService"):UserOwnsAsset(player, id) == false
then print(player.Name.." Does not own this gamepass.")
end
end)
What did I do wrong?

4 comments
I don't know why it split the code to every other line
Do you own the gamepass?
Yes, I do.
You should be using: UserOwnsGamePassAsync instead of UserOwnsAsset: https://developer.roblox.com/api-reference/function/MarketplaceService/UserOwnsGamePassAsync