Roblox game pass script
A pass players can buy for a perk: this one makes them faster. It checks who owns it when they join, gives the perk at each respawn, and has a button to buy it in your game.
Where it goes
- 1On the Creator Dashboard, open your game, go to Passes under Monetization, make a pass, set it for sale and copy its ID.
- 2Add the first script to ServerScriptService, and put your ID in
PASS_ID. - 3In StarterGui, add a ScreenGui with a TextButton in it. Add the second script as a LocalScript inside the button, with the same ID.
-- From forja.us/tools/roblox-scripts/game-pass-- Gives the perk to players who own the pass.local MarketplaceService = game:GetService("MarketplaceService")local Players = game:GetService("Players")local PASS_ID = 0 -- your pass's idlocal PASS_SPEED = 28local owners = {}local function givePerk(character) local humanoid = character:WaitForChild("Humanoid") humanoid.WalkSpeed = PASS_SPEEDendlocal function onPlayerAdded(player) player.CharacterAdded:Connect(function(character) if owners[player] then givePerk(character) end end) local ok, owns = pcall(function() return MarketplaceService:UserOwnsGamePassAsync(player.UserId, PASS_ID) end) if ok and owns then owners[player] = true if player.Character then givePerk(player.Character) end endendPlayers.PlayerAdded:Connect(onPlayerAdded)Players.PlayerRemoving:Connect(function(player) owners[player] = nilend)-- Bought while playing: the perk starts right away.MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, passId, purchased) if purchased and passId == PASS_ID then owners[player] = true if player.Character then givePerk(player.Character) end endend)-- From forja.us/tools/roblox-scripts/game-pass-- Opens Roblox's window to buy the pass.local MarketplaceService = game:GetService("MarketplaceService")local Players = game:GetService("Players")local PASS_ID = 0 -- your pass's idscript.Parent.Activated:Connect(function() MarketplaceService:PromptGamePassPurchase(Players.LocalPlayer, PASS_ID)end)How it works
UserOwnsGamePassAsyncasks Roblox if the player owns the pass.pcallkeeps the script running if Roblox can't answer.- The perk is given on the server, at each respawn: a player's own device can't be trusted with it.
PromptGamePassPurchaseFinishedgives it at once to someone who buys during play.
Make it yours
- Another perk
- Change what
givePerkdoes, such as giving a tool from ServerStorage. - What to charge
- You keep 70% of each sale: the tax calculator works out the price.
Maps to try it on: simulator and tycoon maps
Start from a finished map, and your scripts have a game to run in.
More free Roblox scripts
Roblox kill brick scriptRoblox leaderboard scriptRoblox save data scriptRoblox sprint scriptRoblox double jump scriptRoblox teleport scriptRoblox obby checkpoint scriptRoblox coin pickup scriptRoblox day and night cycle scriptRoblox developer product scriptRoblox door scriptRoblox tool giver scriptRoblox round system scriptRoblox background music scriptRoblox speed pad scriptRoblox jump pad scriptRoblox VIP door scriptRoblox daily reward scriptRoblox NPC dialogue scriptRoblox pet follow scriptRoblox gun scriptRoblox admin commands scriptRoblox tycoon dropper scriptRoblox shop GUI script

