I've been looking into in pairs, and I have this problem with this simple script. What I want it to do is, remove all the hats a player would have when he spawns. I thought using game.Players.PlayerAdded:connect(function() would help since I want it when the player joins but of course if the player dies I don't want them to have the hats on. Additionally, this script was working when "Hat" was set to "BasePart" before. I have no idea why the hats don't want to get removed even though the player's parts did.
This is in a local script in startpack.
--[[]]--
local player = game.Players.LocalPlayer.Character
--Main
function RemoveBody()
for i, v in pairs(player:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
wait(.1)
end
end
end
RemoveBody()

1 comment
starterpack*