1 | local p = game.Players.LocalPlayer |
2 | p.CharacterAdded:Connect( function (ch) |
3 | ca = p.Character |
4 | end ) |
5 | local m = p:GetMouse() |
6 | local UIS = game:GetService( "UserInputService" ) |
7 | ca.Humanoid.WalkSpeed = 25 |
attempt to index a nil value, line 8
CharacterAdded fires in the same tick as the character begins to exist.adding everything to it and setting it as the player's character will not happen when the event is called.
I recommend instead of that, doing this.
1 | local p = game.Players.LocalPlayer |
2 | local ca = p.Character or p.CharacterAdded:Wait() |
3 |
4 | local m = p:GetMouse() |
5 | local UIS = game:GetService( "UserInputService" ) |
6 | ca.Humanoid.WalkSpeed = 25 |
ca will be the character no matter what, as it will wait for it to get added if it needs to.