i have problem when getting the animation to work
i have the left shift sprinting system that use aa animation. the problem i came across is when player stop holding the left shift button but the sprinting animation still play when the character is in walking state (i have animation for walking too). Can you guys help me ? 😅
'''lua
local Players = game:GetService("Players")
local localplayer = Players.LocalPlayer
local humanoid = localplayer.Character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
local walkanimation = Instance.new("Animation")
walkanimation.AnimationId = "rbxassetid://113702852310380"
local walkani = animator:LoadAnimation(walkanimation)
local runanimation = Instance.new("Animation")
runanimation.AnimationId = "rbxassetid://123545909249190"
local runani = animator:LoadAnimation(runanimation)
humanoid.Running:Connect(function(speed)
-- Stop both animations first
walkani:Stop()
runani:Stop()
if speed > 0 and speed <= 16 then
walkani:Play()
elseif speed > 16 then
runani:Play()
else
end
end)
'''