The script goes into the specific tool and then I move the tool into a specific team (I have a team tool script). It works the only problem is that if I do <4 none of the ranks under “4” get the tool but every rank above “4” so 5,6,7,8 etc… get it. How do I make it werre only that specific rank can get the tool. I need it written like it is now to make it simple for me. So I can just drag the script into the tool and put it the team I desire.
Current Script
wait()
if game.Players.LocalPlayer:GetRankInGroup(123456) < 1 and script.Parent.ClassName ~= “Team” then
script.Parent:remove()
end
I’ve tried to change it to >= instead of < but it has the opposite effect: example => 4 | It’ll give all the tools to ranks under 4 but not to ranks above 4…
local groupId = 0--the group id
game.Players.PlayerAdded:Connect(function(plr)
-- get rank
local rank = plr:GetRankInGroup(groupId)
if rank >= 4 then
local tool = game.ServerStorage.Tool:Clone() -- the path of tool, this assumes its in server storage
tool.Parent = plr.Backpack
else
print("nah")
end
end)
EDIT: It’s bad practice to do important things on the client, if you can do it on the server it’s probably better to not use the client
You are able to do this by adding an and to the if function.
(using @Sniperkaos code)
local groupId = 0--the group id
game.Players.PlayerAdded:Connect(function(plr)
-- get rank
local rank = plr:GetRankInGroup(groupId)
if rank >= 4 and plr.Team == game:GetService("Teams")["Team Name"] then
local tool = game.ServerStorage.Tool:Clone() -- the path of tool, this assumes its in server storage
tool.Parent = plr.Backpack
else
print("nah")
end
end)
Keep in mind this script runs as soon as the player joins, so you may need to set their team before this, or just run this code when they join the specified team.
Sorry, if this is a dumb question but what do I do if I want to add multiple tools to one rank? Do I just copy and paste the same script but change the tool name?