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

How i make clickable player characters?

Hello, so 4 hours later when i made this post i made a question for how to fix my clickable character. (https://scriptinghelpers.org/questions/91321/clickdetector-in-players-character-problem)

Now i want ask how i can make it.

My method was create a Player.CharacterAdded function to clone a ready clickdetector from serverstorage and cloned it in HumanoidRootPart(Not Worked),Torso(Not Worked) and all parts of character body. No errors was shown in devconsole.

If you make a working method tell me in comments.

1 answer

Instead of putting it into the HumanoidRootPart, put it in their Character. The way, they can click any part of their Character and it will still detect.

local Players = game:GetService('Players')

function onClicked(playerWhoClicked)
	-- your code here for when player clicks on it
end

function addClickDetector(Character)
	local CD = Instance.new('ClickDetector')
	CD.Parent = Character
	CD.MaxActivationDistance = 10
	CD.MouseClick:Connect(onClicked)
end


Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(addClickDetector)
end)

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