I want my running animation to play when I hold shift, and when I let go it stops.
The issue is that the running animation looks like glitched while holding shift.
I have tried editing the Animate script in the Character, but I do not know what to edit.
Run AnimationId: rbxassetid://2510198475
LocalScript in StarterGui:
-- Services
local PlayerSerivce = game:GetService("Players")
local TweenService = game:GetService("TweenService")
-- User Related References
local Player = PlayerSerivce.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = game.Players.LocalPlayer:GetMouse()
-- Animation
local CharacterAnimation
local Running = false
CharacterAnimation = Character.Humanoid:LoadAnimation(game:GetService("ReplicatedStorage"):WaitForChild("Run"))
-- Functions
function ChangeFOV(FOV)
if not Character then Character = Player.Character or Player.CharacterAdded:Wait() end
local Camera = game.Workspace.Camera
local Tween = TweenService:Create(Camera, TweenInfo.new(0.1), {FieldOfView = FOV})
Tween:Play()
end
local function StartRunning()
ChangeFOV(80)
CharacterAnimation:Play()
CharacterAnimation:AdjustSpeed(1.4)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 14
end
local function StopRunning()
ChangeFOV(70)
CharacterAnimation:Stop()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 10
end
-- Main
Mouse.KeyDown:connect(function(Hotkey)
if Hotkey == "0" then
StartRunning()
end
end)
Mouse.KeyUp:connect(function(Hotkey)
if Hotkey == "0" then
StopRunning()
end
end)