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?
local id = 5179136 script.Parent.ClickDetector.MouseClick:Connect(function(player) game.MarketplaceService:PromptGamePassPurchase(player, id) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then print(player.Name) else print(player.Name.." Does not own this gamepass.") end end)
So first at the start you did script.Parent.Mouseclick and forgot the Clickdetector xd
Second of all UserOwnsGamePassAsync needs the player id and not only the player. So Instead of doing (player, id), its (player.UserId, id). I also made it a little simplier :)