Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would you make a button appear only to those who have a gamepass?

I've been looking everywhere and trying every script, but all of them just, don't work. How would you make a button ONLY appear to those who bought a certain game pass? For example, the normal gun is for every user, right? And there's a special one called "Cat Gun" which fires cats. (lol) And I wanted the cat gun to only appear for those who bought my game pass.

I'm extremely sorry if this is considered a request.

1 answer

I'm sorry if I wasn't supposed to do this, wasn't sure. Just take down my answer if I wasn't.

I don't know if I'm supposed to be doing this, but I'll explain through comments so you learn at least.

Server script in serverscript service

local MarketPlaceService = game:GetService("MarketplaceService")

local GuiToShow = -- put the location of your GUI here

local GamepassID = -- Put the ID of your gamepass here
game.Players.PlayerAdded:connect(function(plr) -- Trigger when player enters game
        if MarketPlaceService:UserOwnsGamePassAsync(plr.UserId, GamepassID) then
        plr.CharacterAdded:connect(function(char)
         GuiToShow:Clone().Parent = plr.PlayerGui
      end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.