How to make different group ranks get tools

One second
Im testing the other guys script

Hey is it possible to duplicate the script many times for more ranks?

Just copy and paste and change the table thingy

local tools = {
	game.ServerStorage.Tool1,
	game.ServerStorage.Tool2, 	--Defines the tools and makes it easier to do stuff. You can add more if you want to but you need a comma after every one up until the second to last one.
	game.ServerStorage.Tool3
	
}										

local grp = 00000 	--Replace 00000 with your group ID.

---

game.Players.PlayerAdded:Connect(function(plr)	--Connects a function when a player joins
	if plr:GetRankInGroup(grp) >= 000 then 	--Checks if they are above minumum rank
		plr.CharacterAdded:Connect(function()	--Connects a function when the player respawns/spawns
			local tool = tools[1]:Clone()	--Clones the tool and defines it
			tool.Parent = plr.Backpack	--Moves the tool into the player's backpack
		end)
	end
    if plr:GetRankInGroup(grp) >= 000 then 	--Checks if they are above minumum rank
		plr.CharacterAdded:Connect(function()	--Connects a function when the player respawns/spawns
			local tool = tools[2]:Clone()	--Clones the tool and defines it
			tool.Parent = plr.Backpack	--Moves the tool into the player's backpack
		end)
	end
end)

So I can copy the scipt for more ranks?

Only the middle part,

    if plr:GetRankInGroup(grp) >= 000 then 	--Checks if they are above minumum rank
		plr.CharacterAdded:Connect(function()	--Connects a function when the player respawns/spawns
			local tool = tools[2]:Clone()	--Clones the tool and defines it
			tool.Parent = plr.Backpack	--Moves the tool into the player's backpack
		end)

Ay last thing
tools[1,2]
How can I add multiple items?

Sorry for the late response. You can add multiple items by copy and pasting

local tools = {
	game.ServerStorage.Tool1,
	game.ServerStorage.Tool2, 	
	game.ServerStorage.Tool3,
	game.ServerStorage.Tool4,
	game.ServerStorage.Tool5,
	game.ServerStorage.Tool6
etc
}					

Make sure the last “game.ServerStorage.Tool6” does not have a comma after it.


To add more ranks, just copy and paste this under the other one:

game.Players.PlayerAdded:Connect(function(plr)	--Connects a function when a player joins
	if plr:GetRankInGroup(grp) >= 000 then 	--Checks if they are above minumum rank
		plr.CharacterAdded:Connect(function()	--Connects a function when the player respawns/spawns
			local tool = tools[1]:Clone()	--Clones the tool and defines it
			tool.Parent = plr.Backpack	--Moves the tool into the player's backpack
		end)
	end
end)
  • Change “000” to the rank and change the number in “tools[1]” to the tool number.
  • You can also change “>=” to “==” if you want it so only one rank gets the specified tools.
game.Players.PlayerAdded:Connect(function(plr)
     if plr:GetRankInGroup(grp) == 000 then
  • If you want to give one rank more than one tool, you can copy and paste
local tool = tools[1]:Clone()
tool.Parent = plr.Backpack

under the previous tool.Parent = plr.Backpack
Just make sure to change “tool” to another word each time and make sure to change the “1”

Okay but like on the thing thats say Tools[1] How do I make the rank have more then just 1 tool

I just updated my post and included info on how to give a rank one more tool.

game.Players.PlayerAdded:Connect(function(plr)	--Connects a function when a player joins
	if plr:GetRankInGroup(grp) >= 000 then 	--Checks if they are above minumum rank
		plr.CharacterAdded:Connect(function()	--Connects a function when the player respawns/spawns
			local tool = tools[1]:Clone()	--Clones the tool and defines it
			tool.Parent = plr.Backpack	--Moves the tool into the player's backpack
			local tool2 = tools[2]:Clone()	
			tool2.Parent = plr.Backpack	
		end)
	end
end)

Thank you!

No problem! Feel free to let me know if the script has any issues.

1 Like