Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

FindFirstChild() is ignored?

I have a tool, that removes 18 hp from the player that gets clicked on. If the thing that gets clicked on doesn't have a humanoid, it will print("No humanoid found")

But now, it prints "No humanoid found" although I click on a player.

Tool script: (Client side, local script)

tool = script.Parent
player = game.Players.LocalPlayer


tool.Equipped:Connect(function(mouse)
	mouse.Icon = "http://www.roblox.com/asset/?id=2312592107"
	mouse.Button1Down:Connect(function()
	game.Workspace.KillExplosion.KillExplosionCreate:FireServer(mouse.Target, tool.Handle)
	
	
	end)
end)


Server script: (Server side, normal script)

debounce = false

	script.KillExplosionCreate.OnServerEvent:Connect(function(player, target, tool)	
		if debounce == false and target.Parent:FindFirstChild("Humanoid") == true then
			print("found humanoid")
			debounce = true
			wait(1)
			debounce = false
		else
			print("no humanoid found")
	
	end
end) 

Thank you for help!

1 answer

✓ Accepted answer

remove the == true at findfirstchild, a humanoid isnt a true or a false value

debounce = false

    script.KillExplosionCreate.OnServerEvent:Connect(function(player, target, tool) 
        if debounce == false and target.Parent:FindFirstChild("Humanoid")  then
            print("found humanoid")
            debounce = true
            wait(1)
            debounce = false
        else
            print("no humanoid found")

    end
end) 

14 comments

0

I still get the same error.

1

you sure? i tested it in studio myself

1

Make sure the model you are clicking on has a humanoid in it as the descendant of target.Parent

0

Let me check again.

1

and also, make sure it is named exactly Humanoid, the model i used to test this one was the drooling zombie,its a free model you can take

0

Actually, when I test on a server, I did not print ANYTHING.

0

Ok I will test.

0

I will come back to you tomorrow ok?

1

all the printed outputs are on the server, not the individual players screens as you put the print in a server side script

0

Oh! True, I will check.

0

You are a fu**ing genius.

0

Thanks man! It worked.

0

Now I will upvote all comments, give you some points ;)

0

no prob bro, thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.