Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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)
Ad

Answer this question