function prepPlayer() local children = game.Players:GetChildren() for i = 1, #children do hum = children[i].Character:WaitForChild("Humanoid") hum.WalkSpeed = 30 end end
How do I get the humanoid for all players in game? This is what I have, and I can't figure out what is wrong with the script.
There doesn't appear to be anything wrong with your code with the exception of a few gotchas and nil checks
function prepPlayer() local children = game.Players:GetPlayers() for i = 1, #children do local hum = (children[i].Character or children[i].CharacterAdded:wait()):WaitForChild("Humanoid") hum.WalkSpeed = 30 end end