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.

3 comments
there is probably an easier way but you could do something like for i,v in pairs(character) do if v.Class == Accessory then v:Destroy()
A function doesnt run unless called.
I'm so stupid you're right thank you. @DinozCreates