I'm trying to make it that once you hover your mouse in a Player, the tool activates.
mouse = game.Players.LocalPlayer:GetMouse()
me = game.Players.LocalPlayer.Name
tool = game.Players.LocalPlayer.Character:WaitForChild('Sword')
function find_player(str)
for i,v in pairs (game.Players:GetChildren()) do
if v.Name ~= me then
if v.Character then
if game.Players:FindFirstChild(str) then
return true
end
end
end
end
end
while wait(0.01) do
if mouse.Target then
if find_player(mouse.Target.Name) or find_player(mouse.Target.Parent.Name) or find_player(mouse.Target.Parent.Parent.Name) or find_player(mouse.Target.Parent.Parent.Parent.Name) then
tool:Activate()
end
end
end

7 comments
if mouse.Target and mouse.Target.Parent then
You've got to make sure the parent of target exists before indexing it. Otherwise, you might end up doing nil.Name, or something similar.
@yHasteeD, it still throws the same error. (line 20)
add another end on line 24? Maybe in correct number of ends?
the error is on line 20, it says attempt to index field 'Parent' a nil value. @WideSteal321
Just try it.
Actually look at the error and try to understand what it means. You're taking the parent of the parent of the parent. Just think about it. Only one of those parents need not exist in order to throw that error.