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

Gamepass not working?

local BallButton = script.Parent
local player = game.Players.LocalPlayer

BallButton:findFirstChild("Reg").MouseButton1Click:connect(function()
 game.Workspace.ValueFile.BallType.Value = 0
end)

BallButton:findFirstChild("Blue").MouseButton1Click:connect(function()
 if game:GetService("GamePassService"):PlayerHasPass(player, 159205131) then
 game.Workspace.ValueFile.BallType.Value = 1
 end
end)

BallButton:findFirstChild("Red").MouseButton1Click:connect(function()
 if game:GetService("GamePassService"):PlayerHasPass(player, 159602182) then
 game.Workspace.ValueFile.BallType.Value = 2
 end
end)

Why does it print (Game passes can only be queried by a Script running on a ROBLOX game server) in a game server

I cannot figure out this error.

3 answers

The gamepass and the script might be working fine. Unfortunately, you can't test GamePasses in Roblox Studio. You have to actually be playing the game for the service to start.

1 comment

0

Yes, thats where I've been testing.

This is not an answer;

This script was tested in game with roblox play and it gave a response like it usually only would on studio... I am part of Yellow's Dev team so I was clearing some things up.... I hope this helps people answer this problem.

The output is strange because it should only print this in studio test but it is doing this in a real server with real accounts... Please help!

1 comment

0

Found the answer! U didn't find the userId

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