Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does Mouse.Target work on Humanoids?

Asked by 7 years ago

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

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

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.

Ad

Answer this question