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

why wont :PlayHasPass() see if the player has a gamepass?

Asked by 5 years ago

i have a script that when a player joins it detects if a player has a gamepass. I try to figure out why it doesn't work but nothing works. Why doesn't it work?

game.Players.PlayerAdded:Connect(function(player)
    local value = Instance.new("BoolValue",player)
    value.Name = "HasHazardShow"
    local service = game:GetService("MarketplaceService")
    if service:PlayerOwnsAsset(game.Players[player.Name], 5115790)then
        value.Value = true
    else    
        value.Value = false
    end
end)
2
"game.Players[player.Name]". That's redundant Rare_tendo 3000 — 5y
0
True, and use UserOwnsGamePassAsync Gamepasses are no longer assets piRadians 297 — 5y

1 answer

Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago
Edited 5 years ago

You can't do that, the correct function for a gamepass is UserOwnsGamePassAsync since gamepasses are not assets.

 if service:UserOwnsGamePassAsync(player.UserId, 5115790)then

1
Thanks, because all the dev wikis and stuff i looked at said to use that.. I guess they need to be updated. Creeper_Dude158 11 — 5y
0
I would recommend looking in the actual roblox wiki, they have all deprecated items there. piRadians 297 — 5y
Ad

Answer this question