I want to make a running script that changes the animations from walking to running when I press shift and I want it to happen automatically so I don’t have to stop moving for it to work
I already got a running script
I was wondering how this could be done because I was trying by myself for a while and it wasn’t working.
Running script:
local speed = 30
local norm_spd = 16
local ke_y = Enum.KeyCode.LeftShift
local fovMax = { FieldOfView = 70 + (speed/5) }
local fovMin = { FieldOfView = 70 }
local thing = game.Workspace.CurrentCamera
local tween = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMax)
local tween2 = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMin)
local UIS = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
UIS.InputBegan:Connect(function(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == ke_y then
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character.Humanoid
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = speed
tween:Play()
end
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == ke_y then
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character.Humanoid
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = norm_spd
tween2:Play()
end
end)