local p = game.Players.LocalPlayer p.CharacterAdded:Connect(function(ch) ca = p.Character end) local m = p:GetMouse() local UIS = game:GetService("UserInputService") 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.
local p = game.Players.LocalPlayer local ca = p.Character or p.CharacterAdded:Wait() local m = p:GetMouse() local UIS = game:GetService("UserInputService") 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.