RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a script that spam deletes everything that's name is over 10 letters long"
The following script will delete every object in the workspace whose name is longer than 10 characters. Please use this script with caution, as it will remove parts without the possibility of undoing the action. It's recommended to test this in a safe environment where you won't lose important work. ```lua local function deleteLongNamedObjects() for _, obj in pairs(workspace:GetDescendants()) do if #obj.Name > 10 then obj:Destroy() end end end -- Call the function to start deleting objects deleteLongNamedObjects() ``` This script will run once and remove all objects at the time of execution. If you want it to continuously check and delete objects as they are created or renamed, you would need to set up a `RunService` loop or use event listeners to trigger the deletion when new objects are added to the workspace. Here's an example using `RunService` to continuously check for objects with names longer than 10 characters: ```lua local RunService = game:GetService("RunService") local function deleteLongNamedObjects() for _, obj in pairs(workspace:GetDescendants()) do if #obj.Name > 10 then obj:Destroy() end end end RunService.Heartbeat:Connect(deleteLongNamedObjects) ``` Be aware that this script will have a performance impact on your game, especially if there are many objects in the workspace. It's also important to note that this script will delete any object, including those that may be essential to your game's functionality. Use with extreme caution.