So, I have a script that manipulates multiple things inside the character and fires when someone enters the game, or respawns (or dies).
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(c)
print'fetching player'
repeat wait() until
player.Character
print'fetching character'
local char = player.Character
local hum = char.Humanoid
local head = char.Head
head.Transparency = 1
print'invisible head and no name'
hum.WalkSpeed = 50
for _, v in pairs(char:GetChildren()) do
wait()
if v:IsA("Hat") then
v:Destroy()
end
end
print'removing hats'
local h = Instance.new("Hint", game.Workspace)
h.Text = "Welcome "..player.Name.." to GAMENAMEHERE"
wait(5)
h:remove()
local h2 = Instance.new("Hint", player.PlayerGui)
h2.Text = "All hats are removed so you get more anti-gravity effect"
wait(5)
h2:remove()
print'welcome'
local nograv = Instance.new("BodyForce", char.Torso)
nograv.force = Vector3.new(0,2000,0)
print'good to go'
end)
end)
So far, everything in this script is working well, except for one thing.
for _, v in pairs(char:GetChildren()) do
wait()
if v:IsA("Hat") then
v:Destroy()
end
end
The above code is not firing.
Help?

1 comment
Thank you :)