Hello, I have a script that will give a pistol. However, I do not want infected players to be able to access the tool, I only want Humans to be able to. There are 2 teams. "Humans" and "Infected" How can I make the script to only give the tool to "Humans"?
Here is the script
local tool = game.ServerStorage.Pistol -- Pistol is the item local clone = tool:clone() script.Parent.ClickDetector.MouseClick:Connect(function(plr) if clone.Parent ~= plr.Backpack then clone.Parent = plr.Backpack else end end)
You can check the name of a player's team by doing plr.Team.Name
So I just added that to your code
local tool = game.ServerStorage.Pistol local clone = tool:clone() script.Parent.ClickDetector.MouseClick:Connect(function(plr) if plr.Team.Name == 'Humans' then if clone.Parent ~= plr.Backpack or plr.Character then clone.Parent = plr.Backpack end end end)