I would like to change this script to a stamina script where u can only run for like 25 seconds and when that 25 seconds is up you have to wait a little for it to comeback, but i want the run speed to very slowly decline through those 25 seconds. Here’s my script without stamina that I would like to have the stamina script implemented into
local UIS = game:GetService(‘UserInputService’)
local Player = game.Players.LocalPlayer
local TweenService = game:GetService(“TweenService”)
local Character = Player.Character
local humanoid = Character.Humanoid
local Anim = Instance.new(‘Animation’)
Anim.AnimationId = ‘rbxassetid://11146777848’
PlayAnim = Character.Humanoid:LoadAnimation(Anim)local TweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine)
local runGo = TweenService:Create(humanoid, TweenInfo, {WalkSpeed = 35})
local runStop = TweenService:Create(humanoid, TweenInfo, {WalkSpeed = 16})UIS.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
if Character.Humanoid.MoveDirection.Magnitude > 0 then
PlayAnim:Play()
runGo:Play()
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
wait()
end
else
PlayAnim:Stop()
runStop:Play()
end
end
end)UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
if Character.Humanoid.MoveDirection.Magnitude < 0 then
PlayAnim:Stop()
runStop:Play()
for i = 1,5 do
game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
wait()
end
else
PlayAnim:Stop()
runStop:Play()
end
end
end)