I am trying to make a shift to sprint script, I put a localscript in the starter pack that on key shift down walk speed should be 25 while key shift up walkspeed should be 16.
LocalScript:
01 | local plr = game.PLayer.LocalPlayer |
02 | local uis = game:GetService( "UserInputService" ) |
03 | local character = plr.Character or plr.CharacterAdded:Wait() |
04 | local humanoid = character.Humanoid or character:WaitForChild( "Humanoid" ) |
05 |
06 | local shift = Enum.KeyCode.LeftShift |
07 | local Isshiftdown = uis:IskeyDown(shift) |
08 |
09 | uis.InputBegan:Connect( function (Input, gameProcessedEvent) |
10 | if Isshiftdown then |
11 | humanoid.Walkspeed = 25 |
12 | else |
13 | humanoid.Walkspeed = 16 |
14 | end |
15 | end ) |
Change WalkSpeed not Walkspeed.
01 | local plr = game.PLayer.LocalPlayer |
02 | local uis = game:GetService( "UserInputService" ) |
03 | local character = plr.Character or plr.CharacterAdded:Wait() |
04 | local humanoid = character.Humanoid or character:WaitForChild( "Humanoid" ) |
05 |
06 | local shift = Enum.KeyCode.LeftShift |
07 | local Isshiftdown = uis:IskeyDown(shift) |
08 |
09 | uis.InputBegan:Connect( function (Input, gameProcessedEvent) |
10 | if Isshiftdown then |
11 | humanoid.WalkSpeed = 25 |
12 | else |
13 | humanoid.WalkSpeed = 16 -- the error was that you misspelled it! |
14 | end |
15 | end ) |
your supposed to do 'WalkSpeed' not 'Walkspeed'