The Humanoid.Running
event that you refer to fires when the Humanoid starts or stops running, not when the Player
spawns.
If you want to adjust the speed of each player when they spawn from a LocalScript
, all you'd need to do is this:
01 | repeat wait() until game.Players.LocalPlayer |
02 | player = game.Players.LocalPlayer |
04 | repeat wait() until player.Character |
05 | character = player.Character |
07 | repeat wait() until character:FindFirstChild( "Humanoid" ) |
08 | humanoid = character.Humanoid |
10 | humanoid.WalkSpeed = 25 |
The important thing to bear in mind when writing behaviour that should initiate when a Player
spawns is to wait for the Player
's Character
and Humanoid
before trying to modify them.
If you wanted to adjust the WalkSpeed
of each Player
using a global Script
, you would subscribe to the PlayerAdded
event of the Players
GameService
, and then for each Player
reference that you get subscribe to the CharacterAdded
event:
1 | game.Players.PlayerAdded:connect( function (player) |
2 | player.CharacterAdded:connect( function (character) |
3 | while not character:FindFirstChild( "Humanoid" ) do wait() end |
4 | character.Humanoid.WalkSpeed = 25 |