โ† Back to all scripts

Gamepass Check

Check if a player owns a gamepass on join and grant a perk or reward.

GamepassesIntermediateServerScriptService
gamepass-check.lua
-- Gamepass Ownership Check
-- Place in ServerScriptService

local MarketplaceService = game:GetService("MarketplaceService")
local GAMEPASS_ID = 000000

game.Players.PlayerAdded:Connect(function(player)
    local ok, hasPass = pcall(function()
        return MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAMEPASS_ID)
    end)
    if ok and hasPass then
        player.CharacterAdded:Connect(function(char)
            local hum = char:WaitForChild("Humanoid")
            hum.WalkSpeed = 32
        end)
    end
end)
Something broken or not working?
๐Ÿ”ง Try the AI Script Fixer โ†’