How would I remove a specific model OnTouched? Like if theres a Model called "Monkey" then remove?
function onTouched(hit) d. local d = hit.Parent:GetChildren() for i=1, #d do if (d[i].className == "Model") then . d[i]:remove() end end end script.Parent.Touched:connect(onTouched)
If you want to remove a model, first access the model, then remove it. If you want to do that when someone touches something, put it in that event.
Part.Touched:connect(function() Model:Destroy() end)
If you want to remove the model if any part of it is touched, then you need to iterate through every part of the model:
function DestroyModelOnTouch(x,Model) Model=Model or x for _,v in pairs(x:GetChildren())do if v:IsA("BasePart")then v.Touched:connect(function() Model:Destroy() end) end DestroyModelOnTouch(v,Model) end end DestroyModelOnTouch(Model)