Hello, is there a way i can delete everything that is called the same name in a script?
for example, i have everything as decal, i don't want to delete it manually, Is there a way?
local asdnew = Instance.new("TextButton",ScreenGui)
asdnew.BackgroundColor3 = Color3.new(0,0,0)
asdnew.BorderColor3 = Color3.new(0,0,0)
asdnew.Name = "nooties"
asdnew.Position = UDim2.new(1,-150,1,-90)
asdnew.Size = UDim2.new(0,150,0,45)
asdnew.Font = "SourceSansBold"
asdnew.FontSize = "Size14"
asdnew.Text = "Destroy"
asdnew.TextColor3 = Color3.new(255,255,255)
asdnew.MouseButton1Click:connect(function()
game.Workspace.Sound:Destroy()
game.Lighting:Destroy()
game.Workspace.Terrain:Destroy()()
game.Workspace.Camera:ClearAllChildren()()
game.Workspace._CPData:ClearAllChildren()

11 comments
I mean that when i press a button it do the action i want
you can place this script on a function an then call it =D
so i can use the same script with a button, likfe Mouse1Click?
yes
This script can be on any part, it will aways get the workspace
Ok, Thanks! :D
I would be lots happy if you accept my answer =D
In Function Destroy() it tells me to change it to local :(
have you changed something inside of the function?
another advice: try not to name your functions the same name as roblox api functions such as Destroy()
Thanks for the advices, Nonaz!