Hey scriptinghelpers, just wondering how do I prompt a game pass purchase only to users who haven't purchased it yet? The code provided below is what I'm using, it work's even with the prompt purchase. I was wondering how I would prompt the game pass purchase only to users who have not purchased it yet? I have been referring to the MarketplaceService link https://developer.roblox.com/en-us/api-reference/class/MarketplaceService for help with this but, can't seem to find exactly what I'm looking for there so I thought I might as well ask for help. As I always say I'm only here to learn! Thank you for the help in advance, I appreciate it.
This is a Script inside of a Part inside of Workspace.
--did some editing local debounce = true local MarketplaceService = game:GetService("MarketplaceService") local GamepassId = 17468467 script.Parent.Touched:Connect(function(hit) if debounce == true and hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent local player = game:GetService("Players"):GetPlayerFromCharacter(character) MarketplaceService:PromptGamePassPurchase(player, GamepassId)--where im prompting purchasing currently (prompts everyone on touch) if player and MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) and player.leaderstats.Tix.Value >= 666 then debounce = false local avatar = character:GetChildren() for _,t in pairs(avatar) do if t.ClassName == "Part" then local fire = t.Fire fire.Color = Color3.new(1,0,0) fire.SecondaryColor = Color3.new(0,0,0) --tried using else here, only worked if player already owned the game pass end end end wait(1) debounce = true end end) --let me know if you need me to add any more comments about what I've done and am trying to do
Here you go
local success, message = pcall(function() hasPass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) end) -- just use a if statement to check if player haspass like this: if hasPass then --blah blah balch asfuahsf code