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?
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)