So, I made a button that opens a frame if you have the gamepass but I get an error.
Error: Game passes can only be queried by a Script running on a ROBLOX game server
Script:
local button = script.Parent
local player = game.Players.LocalPlayer
local id = 516571966
button.MouseButton1Down:connect(function()
if game:GetService("GamePassService"):PlayerHasPass(player, id) then
if button.Parent.ColorFrame == false then
button.Parent.ColorFrame.Visible = true
end
end
end)

2 comments
Edited for code block.
Please use the edit button on questions, do not make an answer for the script.