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

How do you remove a hat from a player?

Asked by 10 years ago

Now, It's a simple question. I just need help how to.

2 answers

Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
10 years ago

What Shawnyg said should work.

I'll give you another way to do what you want to do.





function removehats() for i, v in pairs(game.Players:GetChildren()) do wait() for i, t in pairs(v.Character:GetChildren()) do if t:IsA("Hat") then t:Destroy() end end end end while true do wait(2) removehats() end
Ad
Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I apologize for the spacing as I just did this without studio

game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(char)
for i,v in pairs(char:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
end)
end)

Answer this question