@Paul00990 Did you manage to get it working?
It is not working for some reason. The tool is in replicated storage
local groupID = 8347300 --your group id
local requiredRank = 255 – the rank needed for the role
local toolLocation = game.ReplicatedStorage.Tools.Detain – find the tool
game.Players.PlayerAdded:Connect(function(plr)
local role = plr:GetRoleInGroup(groupID)
if role >= requiredRank then
local tool = toolLocation:Clone()
local toolCloneAgain = toolLocation:Clone()
tool.Parent = plr.Backpack
toolCloneAgain.Parent = plr.StarterGear
end
end)
Change plr:GetRoleInGroup
to plr:GetRankInGroup
local groupID = 8347300 --your group id
local requiredRank = 255 --the rank needed for the role
local toolLocation = game.ReplicatedStorage.Tools.Detain --find the tool
game.Players.PlayerAdded:Connect(function(plr)
local role = plr:GetRankInGroup(groupID)
if role >= requiredRank then
local tool = toolLocation:Clone()
local toolCloneAgain = toolLocation:Clone()
tool.Parent = plr.Backpack
toolCloneAgain.Parent = plr.StarterGear
end
end)
It still wont work
Let me do some testing real quick.
It worked perfectly fine for me, can you open the output window and tell me what it says?
17:06:05.305 - Project Science [BETA] auto-recovery file was created
Community Leaderboard script loaded
17:06:06.013 - Tools is not a valid member of ReplicatedStorage “ReplicatedStorage”
17:06:06.014 - Stack Begin
17:06:06.014 - Script ‘ServerScriptService.Script’, Line 3
17:06:06.015 - Stack End
17:06:07.656 - Donation Board: Authorised - Loading Modules
17:06:07.657 - HTTP 403 (Forbidden)
17:06:07.657 - Stack Begin
17:06:07.657 - Script ‘Workspace.AdminTools’, Line 62
17:06:07.658 - Stack End
17:06:07.658 - :: Adonis :: Loading existing player: Paul00990
17:06:07.658 - 502: API Services rejected request with error. HTTP 403 (Forbidden)
17:06:07.659 - Stack Begin
17:06:07.659 - Script ‘Workspace.Boards.SettingsHandler’, Line 14
17:06:07.659 - Stack End
17:06:08.210 - Donation Board: ProcessReceipt Activated
17:06:09.935 - :: Adonis :: Loading Complete; Required by 0.31495003846204.Loader.Loader
17:06:11.016 - Infinite yield possible on ‘ReplicatedStorage.ACS_Engine.Eventos.Rappel:WaitForChild(“RopeEvent”)’
17:06:11.016 - Stack Begin
17:06:11.017 - Script ‘ServerScriptService.ACS_Server’, Line 1384
17:06:11.017 - Stack End
17:06:13.563 - :: Adonis :: Beginning Adonis cleanup & shutdown process…
17:06:13.565 - -----------------------------------------------
17:06:13.565 - Adonis is already running! Aborting…
17:06:13.565 - Running Location: Workspace.Adonis_Loader.Loader.
17:06:13.566 - This Location: ServerScriptService.Adonis_Loader.Loader.
17:06:13.566 - -----------------------------------------------
17:06:13.567 - :: Adonis :: Unloading complete
17:06:19.157 - Disconnect from ::ffff:127.0.0.1|57660
Can you show me a screenshot of ReplicatedStorage
?
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)
No problem! Feel free to let me know if the script has any issues.