for index, player in ipairs(game:GetService("Players"):GetPlayers()) do
if player.Character and player.Character:FindFirstChildWhichIsA("Humanoid") then
player.Character.Humanoid.WalkSpeed = 20 -- New value.
end
end
Are you waiting though? If you run the code right when the server runs, the player might not load and it will be for nothing.
I would recommend using i, v in pairs for this. Here’s an example:
local plrs = game.Players:GetChildren()
wait(5) --Gives players a chance to load.
if #plrs >= 1 then --Makes sure there's a player.
for i, v in pairs(plrs) do
v.Character.Humanoid.WalkSpeed = 20 --Change to whatever you want.
print(v.Name.."'s WalkSpeed was changed!") --You can remove this if you want.
end
end
I know I’m responding to this over a year later… But I found why @focasds script wasn’t working.
16 is the default player walk speed. All that was wrong with his script was that the walk speed was changing to it’s original value. Simply have a different variable for the speed you want the player to go.
Changing the speed to 40:
local Speed = 16
local SuperSpeed = 40
for i, Player in pairs (Players:GetChildren()) do
local Character = Player.Character
Character.Humanoid.WalkSpeed = SuperSpeed -- SETS PLAYER SPEED TO 40
Changing the speed back to the standard player speed:
local Speed = 16
local SuperSpeed = 40
for i, Player in pairs (Players:GetChildren()) do
local Character = Player.Character
Character.Humanoid.WalkSpeed = Speed -- RESETS PLAYER SPEED
Yes that is actually pretty easy, as it is a GetDescendants thing, if you want to do that with all players (this only changes speed to all players alive, and wont change it back when someone resets)
local newspeed = 40
function Increase()
for I, child in pairs(game.Players:GetDescendants()) do
if child:IsA("Player") then
child.Character.Humanoid.WalkSpeed = newspeed
end
end
end
wait(5)
Increase()
this has one issue tho, doesnt check for player character, but that shouldnt be an issue. If it is, then ask ask me to add that if you dont know how to do that.