Placing a ClickDetector within a player's body part

Is it possible to put a ClickDetector that is functioning within a player bodypart? I tried doing this, but the clickdetector lost it’s function

I just tried and I don’t think that it is possible unfortunately.

It’s possible, I’ve seen other games do it

I would suggest inserting a part into the player and putting it so it covers the player’s body part you are trying to click, I would then put the click detector into THAT part.

You would do this by:

game.Players.PlayerAdded:Connect(function(Player)
    local ClickPart = Instance.new("Part")
    ClickPart.Name = ("ClickPart")
    ClickPart.Parent = Player.Parent
    ClickPart.Size =
    ClickPart.Position = 
    

    local Click = Instance.new("ClickDetector")
    Click.Parent = ClickPart
end)

Than your normal ClickDetector functions.

it is just use this script

game.Players.PlayerAdded:Connect(function(Player)
       Player.CharacterAdded:Connect(function(Char)
    local ClickPart = Instance.new("Part")
    ClickPart.Name = ("ClickPart")
    ClickPart.Parent = Char
    ClickPart.Size =
    ClickPart.Position = 
    

    local Click = Instance.new("ClickDetector")
    Click.Parent = ClickPart
       end)
end)

also i dont think u need click part for that

Alternatively, if you want to make a character’s body parts clickable you can use RenderStepped and mouse.Target.

EDIT: as @colbert2677 pointed out, a better alternative is to use RunService.Heartbeat

Please never use RenderStepped unless you are updating the Camera or something that would realistically need to be ran before frames are rendered. Always use Heartbeat (unless your system needs to execute before physics simulation, in which you should use Stepped).

1 Like

I noticed that whenever the clickdetector is parented to the player, it never works, even in a separate part. I fixed this by parenting the part to workspace, and welding it to the player

I tried to weld this to the player, but the Part1 doesn’t work @Catherine858

Is your part parented to the player or to workspace?

its parented to workspace i used part.Parent = workspace

Did you create a weld using Instance.new or manually? I made a part in ServerStorage, and manually welded the part, then cloned it and allowed the script to weld it to the player.

I dont use click detector now, i used proximity prompt instead

1 Like