You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
A part that prompts the player who touched it to buy a gamepass, unless they already have it.
What is the issue? Include screenshots / videos if possible!
I’m not sure how to do this…
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
This is my current script (inside a door part). It opens if they have the gamepass, but I want it to prompt a purchase if they don’t… What should I add to the section with
print("Player has no gamepass!") so that it does?
local MarketPlaceService = game:GetService("MarketplaceService") local GamepassId = 11589657 --id here local debounce = false script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if debounce == false then debounce = true local player = game.Players:GetPlayerFromCharacter(hit.Parent) if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassId) then --open door script.Parent.Transparency = 0.9 script.Parent.CanCollide = false wait (0.5) script.Parent.Transparency = 0.7 script.Parent.CanCollide = true wait (0.1) debounce = false else print("Player has no gamepass!") wait (0.5) debounce = false end end end end)
FYI I did not create this code myself…