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

Gamepass won't work with FilteringEnabled?

Hi I am trying to make this script compatible with FilteringEnabled but I do not know how. I know we can't ask for requests but can someone please explain to me what I need to do because the Roblox Wiki on Remote Events is confusing to me.


local plr = game.Players.LocalPlayer;
local button = script.Parent;
local market = game:GetService("GamePassService");
local id = 12345678; --I am using this because I haven't made the gamepass yet

button.Visible = market:PlayerHasPass(plr,id);

1 answer

First off, this should be in a server script. It doesn't work in local scripts, so game.Players.LocalPlayer wouldn't work. Also, I didn't know what you were trying to do with the last line, but I guessed you were trying to make it visible depending on whether they had the pass. Try using this.

local button = script.Parent
local market = game:GetService("GamePassService")
local id = 12345678
 
game.Players.PlayerAdded:connect(function(player)
    if market:PlayerHasPass(player, id) then 
        button.Visible = true
    else
        button.Visible = false
    end
end)

3 comments

0

It won't work if the gamepass is for another game.

0

I made my own gamepass with id 1315813144 but I am not seeing the button.

0

Is it in a server script?

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