Script to disable an item with a certain name

this still goes in??? chars 30

@Moonvane
workspace. only applies to the Workspace.

game.DescendantAdded:Connect(function(desc)
    if desc.Name == "SystemWeld" then
        desc.Enabled = false
    end
end)

This, however, searches the whole game.
It’d be useful to know where the instance spawns, but you could also use

local SystemWeld = game:WaitForChild("SystemWeld")
SysyemWeld:Destroy()

It’s not

script.Enabled = false

but rather

script.Disabled = true

local script or normal? chars 30

@gxenious
Yes, but you need to put a pcall because some things don’t give you permission to check them:
image

Server (normal) Script, not LocalScript

This whole comment is incorrect.
You don’t use server scripts just because they “load faster”, that is completely dependant on the game’s mechanics and graphics.

Your entire comment is incorrect, local scripts load in based on a player joining and where they are, server scripts load in before any players join, as soon as the game starts. This is why .PlayerAdded 100% of the time fires in server scripts when placed properly.

@1BL1ZZARD
I’d recommend one of my suggestions:

These can both be put into Server Scripts

To fix your second comment:

local SystemWeld = game:WaitForChild("SystemWeld")
SysyemWeld:Destroy()

Did you mean to use workspace:WaitForChild(“SystemWeld”) ?
This will never work.

And to fix your first comment:

game.DescendantAdded:Connect(function(desc)
    pcall(function()
        if desc.Name == "SystemWeld" then
            desc.Enabled = false
        end
    end)
end)

Like what I said earlier, it will error saying “Lacking permission” if you attempt to check some items, such as the CorePackages.

none of these scripts actually work

No, I’m sure I know what I wrote.

You have a plugin inserting scripts into your game. All of the scripts above don’t stop sophisticated viruses. Double check your plugins. You could also be adding free models with viruses.

Ok, I fixed them for you so they work now :ok_hand:

no, if i remove the thing called ‘systemweld’ it will work but there are literally hundreds of them

Show us what your explorer looks like, we haven’t got enough information.

If there are hundreds of them inside studio while not in play test something put them there. You can use madpoint83’s server defender if you’d like. Works well for me.

Edit:

thanks to everyone who tried to help. i had one of the game devs clear the game of SystemWelds.

the script is:

for i, v in pairs(workspace:GetDescendants()) do
  if v.Name == "SystemWeld" then
  v:Destroy()
  end
end

Oh I thought you meant to disable it :slightly_smiling_face:
image