Item Giver based on Roles

Hello! I own a hotel where certain ranks get certain tools, how could I make a script that automatically gives a certain rank certain tools?

Thanks,
George.

1 Like

there is a method in the player object called Player:GetRankInGroup(GroupId) and another one Player:GetRoleInGroup(GroupId) the first one gives you the number of that account, the second one gives you the name. I’d use the first one to cut down on code but it’s up to you.

3 Likes

I’d use :GetRankInGroup() in an if statement everytime a new player joins.
So something like this

local tool = (tool location)

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if player:GetRankInGroup(id) (< or > or =) (rank number) then
tool.Parent = player.Backpack
print(char.Name…“'s tools have been given”)
end
end)
end)

Please correct me if I’ve made any mistakes.

2 Likes

You should fire this when their character is added! :slight_smile:

My bad I’ll correct the script now