So, I have a script that gives tools to certain ranks. Although, if you are ABOVE that rank, it gives you the tool anyway. I only want certain ranks given a certain tool.
local tool = game.ServerStorage['[SCP] Card-L1']
function onPlayerSpawned(player)
if player:IsIngroup(groupId) then
tool:Clone().Parent = player.Backpack
end
end
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function()
onPlayerSpawned(player)
end)
end)
function onPlayerSpawned(player)
if player:GetRankInGroup(groupId) == 4 then
tool:Clone().Parent = player.Backpack
end
end
So, the == 4 part does not work. Basically, I want to give the tool to just 4, not anything higher. I made it >= and it worked, but it gave all tools to the higher ranks. Can anybody help?
function onPlayerSpawned(player)
if player:GetRankInGroup(groupId) == 4 then
print("Check")
tool:Clone().Parent = player.Backpack
end
end
(Just to double check that the event is firing)
The roles in a group are assigned numbers between 1 and 255, with 255 being the owner and 0 being a non-member. Rank does not mean the number by which they are listed on the web page.
You can check the rank on the Configure Group page:
Okay, like most others have said it is most likely there is no 4 rank in your group.
As an alternative you can use the GetRoleInGroup() function and instead of having the # you can say if player:GetRoleInGroup(groupid) == "ROLE NAME" then...