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

Getting the error "Game passes can only be queried by a Script running on a ROBLOX game server"?

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

0

Edited for code block.

0

Please use the edit button on questions, do not make an answer for the script.

1 answer

You have to use a server script to query game passes. I would use a remote function to ask a server script if the player has the gamepass and if so, return true.

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