Would it be similar to this? Because this isn't working.
local id = 5348469 game.Players.PlayerAdded:Connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, id) then print(player.Name .. " has the game pass!") else print(player.Name .. " doesn't have the game pass...") end end)
A while ago, roblox changed how they handle gamepasses. They now have them as seperate assets. This caused a url change ("https://roblox.com/game-pass/id") aswell as the change in gamepass-fetching methods.
PlayerHasPass
is broken and no longer in use. Instead, opt to use the new method UserOwnsGamePassAsync
. Additonally, it now take's a players UserId
, not the player
object themselves.
local id = 5348469 game.Players.PlayerAdded:Connect(function(player) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then print(player.Name .. " has the game pass!") else print(player.Name .. " doesn't have the game pass...") end end)