Recently I got several people asking why their gamepasses weren't working in my game. At the time, I just assumed that the pass purchase hadn't gone through yet, so I simply told them to wait. But after a few days, none of them still had the passes. I checked the simple pass script I had and noticed the output throwing tons of warnings that consisted mainly of GamePassId [id here] is not of type Game Pass. Please use MarketplaceService:PlayerOwnsAsset instead.
So I tried using that instead, which was even worse and returned false every single time I used it.
I'm not sure how to fix this.
My extremely inefficient code is written below:
local Players = game:GetService("Players")
local repStorage = game:GetService("ReplicatedStorage")
function giveTool(tool, startGear)
local newTool = tool:Clone()
newTool.Parent = startGear
end
Players.PlayerAdded:Connect(function(plr)
local starterGear = plr:WaitForChild("StarterGear")
if game:GetService("GamePassService"):PlayerHasPass(plr, 4351689) then
giveTool(repStorage:WaitForChild("ToolStorage"):WaitForChild("IT'S JUST AN EGG"), starterGear)
end
if game:GetService("GamePassService"):PlayerHasPass(plr, 4382733) then
giveTool(repStorage:WaitForChild("ToolStorage"):WaitForChild("Protest Sign"), starterGear)
end
if game:GetService("GamePassService"):PlayerHasPass(plr, 4351698) then
for i=1, 10 do
local q = repStorage:WaitForChild("ToolStorage"):WaitForChild("Quarter"):Clone()
q.Parent = starterGear
game:GetService("Debris"):AddItem(q, 1)
end
for i=1, 75 do
giveTool(repStorage:WaitForChild("ToolStorage"):WaitForChild("Quarter"), starterGear)
end
if game:GetService("GamePassService"):PlayerHasPass(plr, 4351704) then
giveTool(repStorage:WaitForChild("ToolStorage"):WaitForChild("Lemonade Stand"), starterGear)
end
end
end)
It is a server script, is in ServerScriptService, and is not disabled.

1 comment
I did all of the above.