I've been trying to make a game pass for my game that on spawn, you would get a different piece of gear. I have been looking at different tutorials and websites, but none of them told me how to add a game pass that gives random gear on spawn. Can you please help me?
Create a folder in ServerStorage called Tools, put the tools you would like to give to a player, then make a script in the workspace and put this in it
local MarketPlaceService = game:GetService("MarketplaceService") --Getting marketplaceservice local players = game:GetService("Players") --Getting the players local tools = game.ServerStorage.Tools:GetChildren --Getting the tools if tools.nil == true then local newfolder = Instance.new("Folder",ServerStorage) newfolder.Parent = game.ServerStorage newfolder.Name = "Tools" --Creates the folder for you if you don't have it :) end local gamepassid = "PUTGAMEPASSIDHERE" --Replace PUTGAMEPASSIDHERE with your gamepass id function spawned(player) local HasGamepass = false --Says you don't have the gamepass local success, message = pcall(function() HasGamepass = MarketPlaceService:UserOwnsGamePassAsync(player.userid, gamepassid) end) if not success then warn("Checking for the game pass, please wait..."..tostring(message)) return end if HasGamepass == true then local randomtool = game.ServerStorage.tools[math.random(1, #tools)] local toolclone = randomtool:Clone() toolclone.Parent = player.Backpack end --Gives a random tool from the folder if you own the gamepass end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function() Spawned(player) end) end) Players.PlayerSpawned:Connect(Spawned)
Also, scripting helpers is for help with code, not request code. Let me know if this works!