The following is a server-side script located in ServerScript Service:
local Players = game:GetService("Players")
function onPlayerSpawned(player)
player.CharacterAdded:connect(function(char)
local humanoid = char:WaitForChild("Humanoid")
humanoid:RemoveAccessories()
end)
end
game.Players.PlayerAdded:connect(function(player)
onPlayerSpawned(player)
end)
The goal here is to remove all accessories (hats + hair) from the player - that way they aren’t over-riding our accessories we give them in-game.
Thanks ahead of time to any programming guru that helps out.
for _,child in pairs (humanoid.Parent:GetChildren()) do
if child:IsA("Accoutrement") then
child:Destroy()
end
end
Or
local RunService = game:GetService("RunService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
RunService.Stepped:wait()
for i,v in pairs (char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
end)
end)
as it’s working now - and I haven’t tried your script yet. However I’ve heard that the removeaccessories() function can be faulty, so I will keep your code in mind.
Much appreciated, sorry for essentially the waste of time. I am trying to break my habit of frustrating myself rather then asking for help. It appears I only had to frustrate myself for a couple more minutes.