I am making crawl script but idle anim do not work. How can i fix it?
local UIS = game:GetService("UserInputService")
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:WaitForChild("Animation"))
local anim2 = hum:LoadAnimation(script:WaitForChild("AnimationIdle"))
local isCrawling = false
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.C then
if not isCrawling then
hum.WalkSpeed = 6
isCrawling = true
hum:UnequipTools()
anim:Play()
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
else
hum.WalkSpeed = 16
anim:Stop()
isCrawling = false
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
end
end)
if isCrawling == true and hum.MoveDirection.Magnitude == 0 then -- idle anim
anim2:Play()
end