I have a script that gives a player a tool immediately after buying a game pass in-game.
Here is what I have
local Id = 793933317
local Gamepass = game:GetService("GamePassService")
script.Parent.ClickDetector.MouseClick:connect(function(plr)
game:GetService("MarketplaceService"):PromptPurchase(plr, Id)
if Gamepass:PlayerHasPass(plr, Id) then
game.Lighting.Sabre:clone().Parent = plr.Backpack
game.Lighting.Sabre:clone().Parent = plr.StarterGear
end
end)
It should work, however, I'm getting the error
"game passes can only be queried by a script running on a roblox game server"
Also, is this script looped? I.e will it give the player the tool again after dying?
Help would be much appreciated

1 comment
I think you need to be in an actual roblox server, not in Play Solo.