I need to know how to give ALL players a hat, not just one players.
COMMUNITY QUESTION
How do I give ALL players a hat?
2 answers
If you want to just add it to the Players other Hats:
AHat = nil --Put the hat you need in here.
for i,v in pairs(game.Players:children()) do
if v.Character then
Hat = AHat:clone()
Hat.Parent = v.Character
end
end
To remove the players hats then give new hat:
AHat = nil --Put hat you need here
for i,v in pairs(game.Players:children()) do
if v.Character then
for i,Noob in pairs(v.Character:children()) do
if Noob.className == "Hat" then
Noob:remove()
end
end
AHat:clone().Parent = v.Character
end
end
These did not work out for me. Try using this instead:
NewHatString = game.Lighting.TheHatYouWant --Put the string of the hat in here.
game.Workspace.DescendantAdded:connect(function(TheHat)
if TheHat:IsA("Hat") then
local NewHat = NewHatString:Clone()
NewHat.Parent = TheHat.Parent
NewHat.Name = NewHatString.Name
TheHat:Destroy()
end
end)
Hope it works.
This discussion is preserved as it was. New answers, comments, and votes are closed.
