How to change all players walkspeed using a script?

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

oh but if you need to set speed from moment when player joins its too easy:
first we need to open Game settings
and go to here
изображение_2021-09-19_090127
then will open this menu
and here it is

1 Like

Also, if your game is not published, you can simply click StarterPlayer, then in the properties tab, change the CharacterWalkSpeed:
uifgsdhf

Either way works just fine :smiley:

1 Like

you are too correct :slight_smile:
im tried to find this but im not checked StarterPlayer cuz im forgot where the settings are.

1 Like

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.

-Gedeon

1 Like