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
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:
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