How do I remove players back accessories, then add a custom one when they join the game?

Hi, I’m a bit stuck - I’ve made custom back accessories for players when they join my game. I want to remove their back accessories and add mine. How would I do this?

Remove the CoreGui of the Backpack by using StarterGui:SetCoreGuiEnabled(), Specify the CoreGuiType in the first argument, then the status in the Second, which would be false to turn it off.

Make sure you do this on a LocalScript

1 Like

Hello! I have whipped up a quick little script that will remove all back accessories from a player when they join.

Using the Humanoid:GetAccessories() method, we can get all the equipped accessories of a humanoid as a table of accessory instances.

Using this table, we can loop through all the accessories, filter for back accessories, and remove them.

After this I recommend using the Humanoid:AddAccessory() method to add your custom accessories to the player.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		local humanoid: Humanoid = character:WaitForChild("Humanoid")
		
		for i, accessory: Accessory in pairs(humanoid:GetAccessories()) do
			if accessory.AccessoryType == Enum.AccessoryType.Back then
				game:GetService("Debris"):AddItem(accessory, 0)
			end
		end
		
		-- then add your accessories down here using the `Humanoid:AddAccessory()` method
	end)
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.