Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
21

GamePassService.PlayerHasPass returns FALSE [closed]

Asked by 10 years ago

I have a game that uses the game pass service to award extra tools.

It works pretty well.

Another ROBLOX employee bought my game pass this morning, entered the game, and did not get tools. Resetting the place fixed the problem.

Are there known limitations where this call will fail (i.e. return FALSE when the answer should be TRUE)?

1
I'm pretty sure the request is cached, but from your question, I'm going to go ahead and assume that's not the issue here. User#11893 186 — 10y
5
My question is exactly that - if this result is getting cached under any circumstances, it is a bug ROBLOX needs to fix. Shedletsky 107 — 10y
1
I know it is cached, but it is on the game server. When the game server closes or the player joins another server, the call will work correctly. It will only be cached if it was called once before from the game server. It would be best for it to not be cached at all, so player's don't have to join another server if they buy a game pass in-game. User#11893 186 — 10y

Locked by adark and Articulating

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

4 answers

Log in to vote
5
Answered by
blocco 185
10 years ago

There's this neat twitter post detailing the differences between UserHasBadge, PlayerHasPass and PlayerOwnsAsset.

From the looks of it, what you're probably doing is calling PlayerHasPass before awarding the player the game pass, and then calling it again later once they've received the game pass. Since it returned true after resetting the place, it's probably not in a LocalScript and most likely a caching problem.

Ad
Log in to vote
-1
Answered by 10 years ago

If you are trying to give a sword, I would consider using this.

wait(2)

gpid = 155854150
tools = {"TOOLNAMEHERE"} -put the sword in Lighting

GPS = Game:GetService ("GamePassService")
function respawned (char)
player = game.Players:FindFirstChild(char.Name)
print("Respawned")
if char:FindFirstChild("Head") ~= nil then
print("It's a Player!")
if GPS:PlayerHasPass(player, gpid) then
print("Has GPID")
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
end
else
print("No GPID")
end
end
end
game.Workspace.ChildAdded:connect(respawned)

Log in to vote
-2
Answered by 10 years ago

By default, I use the game:GetService("BadgeService")UserHasBadge(ItemID). It is able to be used with any type of asset, Game Passes, Badges, Models, etc.

Log in to vote
-5
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

Are you sure your function for when a player enters is good? That the event is PlayerAdded, not ChildAdded ? They make a difference.