So I have this part with a ClickDetector and Inside that ClickDetector, I have a shirt and pants.
So when you Click the part it will give you the shirt and pants but it does not seem to be working.
Here is the script:
function Click(mouse)
local pName = script.Parent.Parent.Parent.Parent.Parent.Name
local pPlayer = game.Workspace:findFirstChild(pName)
for j,k in pairs(pPlayer:GetChildren()) do
if k:IsA("Pants") or k:IsA("Shirt") then
k:destroy()
end
end
script.Parent.Pants:clone().Parent = pPlayer
script.Parent.Shirt:clone().Parent = pPlayer
end
script.Parent.MouseClick:connect(Click)
Output: 21:56:42.011 - Workspace.E2 Uniform Case.ClickPart.Head.ClickDetector.Clothes:6: attempt to index nil with 'GetChildren'

4 comments
On line 3, you have "script.Parent.Parent.Parent.Parent.Parent". Is this supposed to be the player? Can you describe where the script is?
The script is inside the Click Detector
Ok. Can you tell me what pName is?
Actually, I know a fix. I'll write out an answer.