If we use this, we would have to rejoin for it to work, so is there any way of getting it to work with the ~~~~~~~~~~~~~~~~~
player still in game?
local passId = 0000000 -- change this to your game pass ID.
function isAuthenticated(player) -- checks to see if the player owns your pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
game.Players.PlayerAdded:connect(function(plr)
if isAuthenticated(plr) then
print(plr.Name .. " has bought the game pass with id " .. passId)
end
end)

3 comments
The best way should be to have the player buy the pass in-game. Otherwise it cannot work. ROBLOX doesn't work with being in a game and buying off of the website.
Also, You need to put your script inside of the ~~~~ lines, where that open space is. Not outside.
I meant, the gamepasses are being bought IN GAME in a GUI.