Unable to clear StarterPack

Hello,

I am trying to create a function that clears the starterpack for the plr when a button is clicked, but it does not do anything unless I make it an OnServerEvent (clears for everyone which I do not want)

Here’s what I have so far:

local function emptyStarterPack(player) – Removes all tools permanently
StarterPack:ClearAllChildren(player)
end

script.Parent.MouseButton1Click:Connect(function()
emptybackpack()
emptyStarterPack()
end)

Thanks.

Try -

local function emptyStarterGear(player) 
   local StarterGear = player.StarterGear
   if StarterGear then
     StarterGear:ClearAllChildren()
   end
end

Or

local function emptyBackpack(player) 
   local Backpack= player.Backpack
   if Backpackthen
     Backpack:ClearAllChildren()
   end
end

Also,
StarterPack:ClearAllChildren(player)
No need to provide player here.

Also, when calling that function, since you provided a parameter, you’d need to provide an argument aswell. In this case, the local player.

2 Likes

This is what I have so far, and only the backpack clears so when you reset you still have the tools from the StarterPack.

1 Like

Clear Starterpack then backpack

1 Like

This should be done on the server, since it will always get added back when a character respawns.

1 Like

When I do it on the server, it clears for everyone.

1 Like

You cannot clear a starter pack, its a top-level service of roblox
There are two feature of this:

  • Anything in this like a tool gets cloned into player backpack on spawn
  • Its a locked service, and therefore not even plugins can disable the service, to prevent hackers

The player have two things

  • Backpack
  • StarterGear

If you ever noticed,even if you clear the backpack, after respawn the tools respawn into your backpack
You can use a remote event to clear the starter gear tools of the player, then they wont get respawned back to the backpack
Like:

game.Players.LocalPlayer.StarerGear:ClearAllChildren()
1 Like

How would you clear specific items?

By looping through it.
Here’s an example:

local Whitelist = {
    'Tool1',
    'Tool2'
}

local StarterGear = Player:FindFirstChild('StarterGear')
local Backpack = Player:FindFirstChild('Backpack')

if (StarterGear and Backpack) then
    local GetStarterGear = StarterGear:GetChildren()
    for Tool = 1, #GetStarterGear do
        local TargetTool = GetStarterGear[Tool]
        if (not table.find(Whitelist, TargetTool.Name)) then
            TargetTool:Destroy()
        end
    end
    
    local GetBackpack = Backpack:GetChildren()
    for Tool2 = 1, #GetBackpack do
        local TargetTool = GetStarterGear[Tool2]
        if (not table.find(Whitelist, TargetTool.Name)) then
            TargetTool:Destroy()
        end
    end
end
1 Like