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

Can anyone help me with this script?

gamepassid=163752053
player = game.Players.LocalPlayer
if game:GetService("GamePassService"):PlayerHasPass(player,gamepassid) then
script.Parent.Visible = true
else
script.Parent.Visible = false
end

when i join the game the gui just disappears and doesn't reconized the player if he/she has the gamepass

2 comments

0

Do you own the gamepass? Also, are you testing this in an actual game, or are you playing solo?

0

yes i do

1 answer

The game pass service does not work correctly from local scripts. Instead, use the MarketplaceService. The PlayerOwnsAsset method also works for checking game passes.

gamepassid=163752053
player = game.Players.LocalPlayer
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,gamepassid) then
script.Parent.Visible = true
else
script.Parent.Visible = false
end

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