Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Say I want all the players accessories off them when they first join, how would I go about that?

Asked by 4 years ago

I haven't scripted for about 7 months so im not sure if this would be good at all

I'm pretty sure its along the lines of

Players = game.Players
Players.CharacterAdded:Connect function()
Player.Character.Hair:Remove()
etc
etc
end

I was hoping to atleast find a tutorial on youtube or something but I mean I could always just rip an accessory/face remover from the workshop and put it where the player spawns, that could actually work why dont I just do that? genius

im gonna post this anyway for advice but im still trying that epiphany I thought of just now

okay bye

2 answers

Log in to vote
3
Answered by 4 years ago

You can use a for loop to iterate through the Character's children, and delete their accessories like so;

game.Players.PlayerAdded:Connect(function(player)
    local char = player.Character
    for _,v in pairs(char:GetChildren()) do
        if v:IsA("Accesory") then
            v:Destroy()
        end
    end
end)
0
do I put this in a localscript or a server script and in which folder? THEGOBLINTOPLAD 0 — 4y
0
Server Script, put it anywhere that Server Scripts can run. zboi082007 270 — 4y
0
as a side note to this great answer, you can replace the for loop with simply: `Character.Humanoid:RemoveAccessories()` User#23252 26 — 4y
Ad
Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Kind of like what zboi said, I'd do something like this:

game.Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(Char)
Plr.CharacterAppearanceLoaded:Wait()
Char.Humanoid:RemoveAccessories()
end)
end)
0
Also it'd go in a ServerScript. ToastyWarmBread 54 — 4y

Answer this question