A group rank team tool

I have been looking all over for this but I am not exacly good with the lua scripting I am more of a builder, but I was wonder if it was possable to make a tool where if you are on a certain team in-game and you had a rank of 5 in a group I will get tools only on that team with that rank.

So in shorter terms bacically a tool thats give on a certain team if your a certain rank in your group.

Thanks.

You could try using “Player:GetRankInGroup(GroupID)” and build off of that.

Heres the Proper Documentation for it:

Thank you, but I am not the best with scripting in lua. I was hopeing to get a premade script, cause I cant find anything that works, and thoes design server that make Roblox products is nonsense.

--Script inside game.StarterPlayer.StarterCharacterScripts
local groupId = 1 --replace with your group id
--Tools is a folder and "Your team tool" is the tool name inside said folder
local tool = game.ServerStorage.Tools:WaitForChild("Your team tool")

local function getPlayerRank(player: Player, groupId: number): number
	local success, response = pcall(function()
		return player:GetRankInGroup(groupId)
	end)
	if success then return response end
	warn(response)
	task.wait(1)
	return getPlayerRank(player, groupId)
end

local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local rank = getPlayerRank(player, groupId)

if rank == 5 then
	tool:Clone().Parent = player.Backpack
end
1 Like

Thank you! I will try this when I wake up tommorow and give feedback.

This worked! Thank you so much!

So I was experimenting with this and its noy exactly the easiest to make multiple tools in one script. Im not exacly a scripter but I dod figure it out. To get multiple tools you have to copy and paste the script 2 times in the same script with a space inbetqeen them for this to work for example:

--Script inside game.StarterPlayer.StarterCharacterScripts
local groupId = 1 --replace with your group id
--Tools is a folder and "Your team tool" is the tool name inside said folder
local tool = game.ServerStorage.Tools:WaitForChild("Your team tool")

local function getPlayerRank(player: Player, groupId: number): number
	local success, response = pcall(function()
		return player:GetRankInGroup(groupId)
	end)
	if success then return response end
	warn(response)
	task.wait(1)
	return getPlayerRank(player, groupId)
end

local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local rank = getPlayerRank(player, groupId)

if rank == 5 then
	tool:Clone().Parent = player.Backpack
end

--Second Script
--Script inside game.StarterPlayer.StarterCharacterScripts
local groupId = 1 --replace with your group id
--Tools is a folder and "Your team tool" is the tool name inside said folder
local tool = game.ServerStorage.Tools:WaitForChild("Your team tool")

local function getPlayerRank(player: Player, groupId: number): number
	local success, response = pcall(function()
		return player:GetRankInGroup(groupId)
	end)
	if success then return response end
	warn(response)
	task.wait(1)
	return getPlayerRank(player, groupId)
end

local character = script.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local rank = getPlayerRank(player, groupId)

if rank == 5 then
	tool:Clone().Parent = player.Backpack
end

Is it possable to make this easier?

local tools = {
	--[rank] = {tools}
	[5] = {game.ServerStorage.Tools:WaitForChild("Your team tool")}
}

--code in between

if tools[rank] then
	for _, tool in pairs(tools[rank]) do tool:Clone().Parent = player.Backpack end
end

I was also wondering if it would also work on a certain team? Also can you put that code in with the main code

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.