I want to make it so if a group rank (like 3-255) holds a specific item it would keep it in their inventory, however, if a guest picks it up or acquires it in their inventory it will destroy/deletes it from them. (Not allowed to hold the tool)
I’m hoping if there’s a source out there I can look or read to make this work. Hopefully, I can make it because I have no clue. I don’t have anything done, but if there’s a source out there I can read and check out it would help me a bunch.
this might help you this function will check on what rank if they are on the group
here is a default code from the dev hub
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(2) == 255 then -- change 2 to your group ID
print("Player is the owner of the group, 'LOL'!")
else
print("Player is NOT the owner of the group, 'LOL'!")
end
end)
tool.Handle.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then -- if they exist
if plr:GetRankInGroup(1) == 255 then -- change 1 to your group ID and 255 to your desired rank
hit.Parent:FindFirstChild("Humanoid"):EquipTool(tool)
else
tool:Destroy()
end
end
end)
in case i suggest putting this script inside a tool the part’ name must be handle or else it wont work
sorry for late reply by the way
local tool = script.Parent
tool.Handle.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then -- if they exist
if plr:GetRankInGroup(1) == 255 then -- change 1 to your group ID and 255 to your desired rank
hit.Parent:FindFirstChild("Humanoid"):EquipTool(tool)
else
tool:Destroy()
end
end
end)