Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script for Gamepass gear will not work, any help?

It will not work, heres my code:

local passid = 6939560 -- The ID of the gamepass goes here
local tools = {"Golden Pistol"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124239  -- The ID of the gamepass goes here
local tools = {"Darkheart"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124275  -- The ID of the gamepass goes here
local tools = {"Knife"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124136  -- The ID of the gamepass goes here
local tools = {"M4A4"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)


local passid = 7124136  -- The ID of the gamepass goes here
local tools = {"AK47"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack	
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

2 answers

✓ Accepted answer

I think it's cause you have local tools = {} on each line and one name can be called once if i'm correct so just change the name I might not be correct i don't really know cause you didn't send an output of the problem

Try it tho it might work >><<

local passid = 6939560 -- The ID of the gamepass goes here
local tools = {"Golden Pistol"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#tools do
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124239  -- The ID of the gamepass goes here
local toolss = {"Darkheart"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#toolss do
game.Lighting:FindFirstChild(toolss[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(toolss[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124275  -- The ID of the gamepass goes here
local toolsz = {"Knife"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#toolsz do
game.Lighting:FindFirstChild(toolsz[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(toolsz[i]):Clone().Parent = player.StarterGear
end
end
end)

local passid = 7124136  -- The ID of the gamepass goes here
local toolsc = {"M4A4"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#toolsc do
game.Lighting:FindFirstChild(toolsc[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(toolsc[i]):Clone().Parent = player.StarterGear
end
end
end)


local passid = 7124136  -- The ID of the gamepass goes here
local toolsk = {"AK47"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local GamePassService = Game:GetService('GamePassService')
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if GamePassService:PlayerHasPass(player, passid) then
for i = 1,#toolsk do
game.Lighting:FindFirstChild(toolsk[i]):Clone().Parent = player.Backpack
game.Lighting:FindFirstChild(toolsk[i]):Clone().Parent = player.StarterGear
end
end
end)

Don't lie. this is a free model and you have no idea of how to script.

local Lighting = game:GetService("Lighting")
local passid = 6939560 -- The ID of the gamepass goes here
local tools = {"Golden Pistol","M4A4","Knife"} -- Here you just put the name(s) of the tool(s) you want given. (Tools must be put in the lighting)
local MarketplaceService= Game:GetService("MarketplaceService")
game.Players.PlayerAdded:connect(function(player)
repeat wait(0.1) until player.Backpack  
repeat wait(0.1) until player.StarterGear
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passid) then
for i = 1,#tools do
Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack
Lighting:FindFirstChild(tools[i]):Clone().Parent = player.StarterGear
end
end
end)

You also have to put the Tools into the Lighing Service. Make sure they have the names "Golden Pistol", "M4A4" and "Knife".

Please accept this answer and don't say free model scripts are your own.

This discussion is preserved as it was. New answers, comments, and votes are closed.