✓ Accepted answer
local script, inside the gun
local gun = script.Parent
local backpack = gun.Parent
gun.Equipped:Connect(function()
if not backpack then
print("a bot has equipped the tool")
else
print("a plr has equipped the tool")
end
end)
I am not sure but I assume NPCs do not have backpacks, if they do the case changes. Then you will need to do this.
Insert a bool into every single npc called "npc". The bool can be false or no doesn't matter.
After you have done that just add a local script inside the gun and write this there:
local gun = script.Parent
local backpack = gun.Parent
local plrornpc = backpack.Parent
gun.Equipped:Connect(function()
if plrornpc:FindFirstChild("npc") then
print("a bot has equipped the tool")
else
print("a plr has equipped the tool")
end
end)
3 comments
Check if the Humanoid's character name and check it if whether it's one of 'game.Players' , ;)
check the*
No, ew. They can just put a part with the same name as the player and put it in Players.