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

Does Mouse.Target work on Humanoids?

Note: Thank you for reading this post and taking some time off your day to read through, comment, or answer my question. I truly appreciate you for doing so and you are the one who makes this community a better place.

As the title says, does Mouse.Target detect Parts in a Model that has a Humanoid in it? For example: If I have a Model that has some Parts in it and a Humanoid instance as well, then if I use the Mouse.Target function to test whether or not there is a Humanoid inside the Model by doing:

local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Moved:connect(function()
	if Mouse.Target.Parent:FindFirstChild('Humanoid') then
		print('Humanoid detected')
	end
end

Will this script print out the message when my cursor is over the Part inside the Model that has the Humanoid in it? Because I've been testing and I couldn't seem to have it work as no signal will come from the Parts inside the Model with the Humanoid.

1 answer

✓ Accepted answer

It will, the only thing is that roblox has a Mouse.TargetFilter property, wich is default set to the clients character model. Do Mouse.TargetFilter = nil and it will detect it.

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