So I'm trying to make a script that deletes everything from a model by clicking on a button but it seems like the script doesn't detect parts that are in the model. Parts are inserted in the model afterwards by using a copy tool that sets the parent of the parts to the model, I also tested it by putting a part in the model in studio and in game it only deletes that part and the parts from copy tool are still in the model, this is the code I'm using
Remote = game.ReplicatedStorage.Clean d = true Remote.OnServerEvent:Connect(function(click) local garage = game.Workspace['Garage_'..click.Name] local usedparts = garage.UsedParts local parts = usedparts:GetChildren() for i, part in pairs(parts) do part:Destroy() end end)
I managed to fix it, the problem was that the copy tool was client only, that's why the script didn't see the parts in the model.