Sorry if the name sounds off. I could not think of a correct name for it. I want to make a script that if you are a certain rank and above you get a certain tool. If you are below you don’t get it. How do I make that? I have searched for multiple youtube videos. Thanks!
Note: I am NOT asking for a script. I simply want something that will help me (ex: youtube video). Thanks for reading btw!
Well you need to get the group Id and then the rank that you want and it’s ID, then you can do an if statement like this
local groupId = groupIdHere
local rankNeeded = rankIdHere
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupId) >= rankNeeded then
-- give the tool
else
return
end
end)
This is just a script that can get you started on it, you can improve it and use it to fit your needs.
local tool = game.ReplicatedStorage.FoodStorage.PremiumMenu
local groupID = 4796549
local rankneeded = 12
local debounce = false
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInHroup(groupID) >= rankneeded then
local tool = tool:Clone()
tool.Parent = Player.Backpack
else
return
end
end)
local tool = game.ReplicatedStorage.FoodStorage.PremiumMenu
local groupID = 4796549
local rankneeded = 12
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(groupID) >= rankneeded then
local tool = tool:Clone()
tool.Parent = Player.Backpack
else
return
end
end)
I would probably change the variable name, ‘tool’, inside the function to something like, ‘toolClone’.
The variable name ‘tool’ shows up twice and it can get confusing in larger scripts. Also, sometimes the script won’t know which variable you’re referring to.
local tool = game.ReplicatedStorage.FoodStorage.PremiumMenu
local groupID = 4796549
local rankneeded = 12
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if player:GetRankInGroup(groupID) >= rankneeded then
local toolClone = tool:Clone()
toolClone.Parent = player.Backpack
else
return
end
end)
end)
What does this have to do with giving it to non-staff members? StarterGear isn’t the same as StarterPack. When you put a tool in StarterGear, it gives them the tool everytime they respawn.