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

How to make clickable characters?

Hey, I have been trying to make a clickDetector within a player model, but it's just not working for me. Any suggestions? Here is the code. (FYI it is stored under "StarterPlayerScripts")

local character = game:GetService("Players").LocalPlayer.Character

local clickable = Instance.new("ClickDetector",character.UpperTorso) clickable.MaxActivationDistance = 12

2 answers

The Upper and Lower Torso are underneath the HumanoidRootPart. Try changing the parent of the click detector to HumanoidRootPart.

6 comments

0

no, it still doesn't work. Does it have to do with the fact that it is a local script under StartPlayerScripts?

0

I've never seen anybody parent an instance like how you did. Instead of doing Instance.new("ClickDetector",character.HRP), try doing clickable.Parent = HRP

0

do I have to declare HRP as a variable? When I created the parent, HumanoidRootPart was underlined in red. here's the updated code for your convenience.

0

local Players = game:GetService("Players") local Player = Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local clickable = Instance.new("ClickDetector") clickable.Parent = HumanoidRootPart

0

Yes, HRP is a child of Character so do local HRP = Character:WaitForChild("HumanoidRootPart")

0

Hm, strange. It's still not working. Is it maybe because it is a local script under startplayerscripts? It isn't even adding the clickdetector when I check the HumanoidRootPart part of the explorer page while in the game.

You can put the click detector under the model, rather than a specific part in the character. This will allow you to click any part of the character.

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