Im a not bad scripter, so i thought i could make a shift to sprint script myself, which i could, but the only twist is, when i hold shift, it does play the animation, but once i release shift, the animation doesnt stop. Im also trying to learn how to make input combinations, so if someone could give me a little guide to that, it would be well appreciated.
my script:
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local camera = workspace.CurrentCamera
local hmd = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local cameraTweenInfo1 = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0)
local cameraTweenGoal1 = {FieldOfView = 80}
local cameraTweenInfo2 = TweenInfo.new(0.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0)
local cameraTweenGoal2 = {FieldOfView = 70}
UIS.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.KeyCode == Enum.KeyCode.LeftShift then
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 26
local sprintAnim = hmd:LoadAnimation(script.SprintAnim)
sprintAnim:Play()
local cameraTween1 = TS:Create(camera,cameraTweenInfo1,cameraTweenGoal1)
cameraTween1:Play()
end
end
end)
UIS.InputEnded:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.KeyCode == Enum.KeyCode.LeftShift then
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
local sprintAnim = hmd:LoadAnimation(script.SprintAnim)
sprintAnim:Stop()
local cameraTween2 = TS:Create(camera,cameraTweenInfo2,cameraTweenGoal2)
cameraTween2:Play()
end
end
end)
i also have this in startergui, if i need to change that.