Hello!
I have a problem with my Rank Donation Center that I am going to do for my self.
But I tried this code to check if the user owns the game pass for the Rank:
Here is the Code:
Rank1Frame.Buy.MouseButton1Click:Connect(function()
if MarketPlace:UserOwnsGamePassAsync(Player,9494497) then
Rank1Frame.Buy.Text = "Rank Me"
else
MarketPlace:PromptPurchase(Player,9494497)
end
end)
Please make sure to read the console because this line would have thrown an exception. MarketplaceService::UserOwnsGamePassAsync requires a user ID, not a player instance.
local PASS_ID = 9494497 -- Put this at the top of your script
local ok, has_pass = pcall(MarketPlace.UserOwnsGamePassAsync, MarketPlace, Player.UserId, PASS_ID) -- Keep this in the function
if ok and has_pass then
Rank1Frame.Buy.Text = "Rank Me"
else
MarketPlace:PromptGamePassPurchase(Player, PASS_ID)
end
I wrapped it in a pcall because the function makes web requests and may or may not fail.
Also, MarketplaceService::PromptGamePassPurchase is for prompting game pass purchases.