Hello! I am trying to give players that have a certain rank in a group tools but when the folder is in the players backpack the player doesnt have the tool. How do I clone the things inside the folder to the players backpack?
Here is my code
local tool = game.ReplicatedStorage["Surgeon+"]
local groupID = 9032922
local rankneeded = 8
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupID) >= rankneeded then
local tool = tool:Clone()
tool.Parent = Player.Backpack
else
return
end
end)
1 Like
Something like this?
local toolfolder = --Your folder here
local groupID = 9032922
local rankneeded = 8
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupID) >= rankneeded then
for i,tool in pairs (toolfolder:GetChildren()) do
tool:Clone().Parent = Player.Backpack
tool:Clone().Parent = Player.StarterGear
end
end
end)
Cloning to StarterGear too so they get the tool on Respawn too
3 Likes
Thank you! This is what I was looking for. If I wanted it to be only a certain rank and not any rank below or above do I just do = rather than >=?
1 Like
If you want it to only give the tools for a specific rank between 0-255, you would use ==
, =
is only used to assign stuff, like assigning something to a variable
2 Likes
Oh ok. Thank you for your time and help
2 Likes
Anytime! If you have anymore issues don’t be afraid to make another post!
2 Likes