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

Cannot click an object in the character model. What should be done?

I have a folder within my character model which has a part that has a script.

Let me illustrate this like so [Imagine this as if it is the explorer]

|_Character

|>|_Folder

|>|>|_Part

|>|>|>|_ClickDetector

|>|>|>|_Script

Problem here is that the players cannot click on anything that is inside their character model. How can I remedy this?

1 answer

game:GetService("Players").PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        for _, v in pairs(char:GetChildren()) do
            if v:IsA"BasePart" then
                local cd = Instance.new("ClickDetector")
                cd.Parent = game.Workspace
                script.ClickDetectorCode:Clone().Parent = cd
                cd["ClickDetectorCode"].Disabled = false --make sure it’s Disabled is set to true! 
            end
        end
    end)

end)

script.Parent.MouseClick:Connect(function(plr)
    -- onClick code goes here 
end)

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