I have a simple run script under StarterCharacterScripts. Here’s the content of it:
local speed = 22
local normalSpeed = 17
local key = Enum.KeyCode.LeftShift
local tween1, tween2 = game.TweenService:Create(game:GetService("Workspace").CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Sine), {FieldOfView = 70 + (speed / 4)}), game.TweenService:Create(game:GetService("Workspace").CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Sine), {FieldOfView = 70})
local playAnim
game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent)
if input.KeyCode == key and not gameProcessedEvent then
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speed
tween1:Play()
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6385158800"
playAnim = game:GetService("Players").LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(Anim)
playAnim:Play()
end
end)
game:GetService("UserInputService").InputEnded:Connect(function(input)
if input.KeyCode == key then
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = normalSpeed
tween2:Play()
if playAnim then
playAnim:Stop()
end
end
end)
Unfortunately when you click Esc key or just click on the Roblox Esc Menu button while running, the run animation still plays after exiting the menu and your speed is still higher than the normal. Also the tween is till there. Does anybody have a good fix for that?
Thanks, Jermartynojm