Is it possible to add a ClickDetector inside a player’s humanoid so they can become clickable?
It is, but I wouldn’t recommend doing this as the Torso might get in the way and make it unclickable.
It all depends on what you are trying to do though, what are you trying to do?
You can attach a part to the character and put a clickdetector inside it. There is documentation about clickdetectors. Or just create a ClickDetector to the HumanoidRootPart. You can also use mouse.Target
and detect if the target is a player, then get their player model from their character or you can just add the clickdetector to the character model as they work in a model.
More here: Ability to click players?
No, it’s not possible? I just tried it now and it didn’t work.
It is possible and it’s also documented. I have used this multiple times.
Actually, you can add click detectors into the character model. Since click detectors work in models! Making it more accurate, type this script. Put the script in serverscriptservice:
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character) -- adds the click detector every time the character is added. ie from respawning or spawning in
local ClickDetector = Instance.new("ClickDetector", Character)
ClickDetector.MouseClick:Connect(function()
-- do stuff
end)
end)
end)
It didn’t work for me, how do you do it
I meant how do you put it inside the humanoid object and make it work
You can’t put it inside the Humanoid object, you can put it inside the HumanoidRootPart.
They meant character. The script I put above will work fine. As it puts a click detector into the player’s character.
Yeah, that’s what I meant by saying it’s not possible
Exactly, clickdetectors will work in models.
I never said it is possible, so what you mean?
I said that to your “it doesnt work” comment.
Why would you do that, it can mess up player movements, having to weld a part to the player. You’d be better off doing what I said instead.
Exactly, I just gave an option. There are multiple ways, however the best way is mouse.Target or yours what I also mentioned. Apologies if my message was unclear.