📜  roblox 检查玩家是否有游戏通行证 - Lua 代码示例

📅  最后修改于: 2022-03-11 14:54:54.502000             🧑  作者: Mango

代码示例2
-- It's not bad code, I just think it could be JUST a bit more organised (if you wanted to add more than one check for gamepasses in the same script)
 
 local id = -- your gamepass id here (look on tutorials on how to get it)
 local marketService = game:GetService("MarketplaceService")

game.Players.PlayerAdded:Connect(function(user)
    if marketService:UserOwnsGamepassAsync(user.UserId, id) then
        -- code that's related to the gamepass.
    end
end)