Might've done the coding wrong, but this is what I did.
-- remove hats and accessories local Players = game:GetService("Players") local function playerAdded(player) player.CharacterAppearanceLoaded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") humanoid:RemoveAccessories() end) end
This is a LocalScript inside StarterGui in case the placement was wrong.
Thank you all in advance.
You have 2 problems. The first is you have forgotten to connect your function (playerAdded) (Line 5), to the PlayerAdded function of the Players Service.
The second problem is that you have made this a LocalScript in the StarterGui. Because this script is replicated to the client AFTER the player joins the game, the PlayerAdded event will not fire for them. Instead, you can put this in a regular script in any place they run (workspace, ServerScriptService, etc.), and it will work as intended.
There is nothing wrong with the RemoveAccessories() function of humanoids.
Revised script:
-- remove hats and accessories local Players = game:GetService("Players") local function playerAdded(player) player.CharacterAppearanceLoaded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") humanoid:RemoveAccessories() end) end Players.PlayerAdded:Connect(playerAdded);
You forgot to run the function playeradded
local Players = game:GetService("Players") game.Players.PlayerAdded:Connect(function (player) -- Forgot to run the function player.CharacterAppearanceLoaded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") humanoid:RemoveAccessories() end) end