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

removing scripts in hats on touch?

I have a script in the spawn, this is what it is:

function onTouched(hit) 
 local xd = hit.Parent:GetChildren() 
  xd.Bloxycolahat.Handle.ChickenSounds:Remove()
wait(.1)
xd.Harmonica.Handle.ChickenSounds:Remove()
  end 

script.Parent.Touched:connect(onTouched) 

I'm not sure why it doesn't work.

1 answer

✓ Accepted answer

###You're looking for specific objects in the model, and you didn't use the GetChildren method correctly. You don't need to check the children, just do this. Also, Remove and connect are deprecated, you should switch to Destroy and Connect

script.Parent.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        part.Parent.Humanoid:RemoveAccessories()
    end
end)

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