Sprint not working after death. Help?
I am configuring a Stamina Gui. Sprinting, Field of view, and moving stamina bar works. But, when I die, sprinting doesn't work. Every other else work, but the sprinting stop working. I need help.
01 | local camera = game.Workspace.CurrentCamera |
03 | local TweeningService = game:GetService( "TweenService" ) |
05 | local UIS = game:GetService( 'UserInputService' ) |
07 | local Bar = script.parent:WaitForChild( 'STMBackground' ):WaitForChild( 'Bar' ) |
09 | local player = game.Players.LocalPlayer |
11 | local NormalWalkSpeed = 16 |
12 | local NewWalkSpeed = 50 |
16 | local sprinting = false |
18 | repeat wait() until game.Players.LocalPlayer.Character |
20 | local character = player.Character |
28 | local TweenInformation = TweenInfo.new( |
30 | Enum.EasingStyle.Quint, |
31 | Enum.EasingDirection.Out, |
37 | local tween = TweeningService:Create(camera,TweenInformation,FOVChanges) |
44 | local TweenInformation 2 = TweenInfo.new( |
46 | Enum.EasingStyle.Quint, |
47 | Enum.EasingDirection.Out, |
53 | local tween 2 = TweeningService:Create(camera,TweenInformation 2 ,FOVChanges 2 ) |
56 | UIS.InputBegan:connect( function (key, gameProcessed) |
57 | if key.KeyCode = = Enum.KeyCode.LeftShift and gameProcessed = = false then |
58 | character.Humanoid.WalkSpeed = NewWalkSpeed |
60 | while power > 0 and sprinting do |
62 | Bar.Size = UDim 2. new(power / 10 , 0 , 1 , 0 ) |
67 | character.Humanoid.WalkSpeed = NormalWalkSpeed |
73 | UIS.InputEnded:connect( function (key, gameProcessed) |
74 | if key.KeyCode = = Enum.KeyCode.LeftShift and gameProcessed = = false then |
75 | character.Humanoid.WalkSpeed = NormalWalkSpeed |
77 | while power < 10 and not sprinting do |
79 | Bar.Size = UDim 2. new(power / 10 , 0 , 1 , 0 ) |
84 | character.Humanoid.WalkSpeed = NormalWalkSpeed |
89 | game.Players.LocalPlayer.Character:WaitForChild( "Humanoid" ).Died:connect( function () |
90 | game.Workspace.Camera.FieldOfView = 70 |
91 | game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16 |