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

Hat removal on Player Added?

Asked by
Sxerks3 65
8 years ago

So, I've been trying to work around a hat removal script when a player first enters a server, but they have not been working. Does anyone know how to do so? My entire script is:

local player = game:GetService("Players").LocalPlayer
game.Players.PlayerAdded:connect(function()
    for _, object in pairs(player.Characer:GetChildren()) do
        if object:IsA("Hat") then
            object:Destroy()
        end
    end
end)

Answer this question