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

how to remove all the players hats when they respawn or reset?

Asked by 9 years ago

i've tried

plr.Character.ChildAdded:connect(function(child)
    if child.ClassName == "Hat" then
        repeat wait() until child.Handle
        child:Destroy()
    end
end)

and it works mostly but sometimes it doesnt

0
So, did it work? GullibleChapV2 155 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I'd use this code, it may not work, but I tried:

game.Workspace.ChildAdded:connect(function(plr)
    local name = plr.Name
    local playerinplayers = game.Players:FindFirstChild(plr.Name)
    playerinplayers.CanLoadCharacterAppearance = false
    for i,v in pairs(plr:GetChildren()) do
        if v:IsA("Hat") then
            v:Destroy()
        end
    end
end)
Ad

Answer this question