RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a gui that only shows up to players who has a certain gamepass"
-- local script in StarterGui local Players = game:GetService("Players") local MarketplaceService = game:GetService("MarketplaceService") local gamePassID = 123456 -- Replace with your game pass ID local gui = script.Parent.MyGui -- Replace with the name of your GUI local function checkGamePass(player) local hasGamePass = false local success, message = pcall(function() hasGamePass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID) end) if success and hasGamePass then return true else return false end end local function onPlayerAdded(player) if checkGamePass(player) then local clonedGui = gui:Clone() clonedGui.Parent = player.PlayerGui end end Players.PlayerAdded:Connect(onPlayerAdded) for _, player in ipairs(Players:GetPlayers()) do onPlayerAdded(player) end