My animation is NOT supposed to look like this:
instead it should be looking like this:
Why is my Animation not working right?
animation on roblox: https://create.roblox.com/dashboard/creations/marketplace/13371859800/configure
my script:
--// Variables
local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
--// Configuration
-- keyBinds
local Crouch = "C"
local CrouchF = "W"
local CrouchB = "S"
local CrouchL = "A"
local CrouchR = "D"
-- Crawl Keybinds
local Crawl = "V"
-- Animation Id's
local CrouchIdle = 13371342611 --> Replace the number with your animation ID!
local CrouchFoward = 13371615380
local CrouchBackward = 13371671426
local CrouchLeft = 13371696371
local CrouchRight = 13371707755
-- Crawl Id's
local CrawlIdle = 13371869583
local CrawlingId = 13371859800
--// Crouch animation finder
local animation = Instance.new("Animation")
animation.AnimationId = 'rbxassetid://' .. CrouchIdle
local animation2 = Instance.new("Animation")
animation2.AnimationId = 'rbxassetid://' .. CrouchFoward
local animation3 = Instance.new("Animation")
animation3.AnimationId = 'rbxassetid://' .. CrouchBackward
local animation4 = Instance.new("Animation")
animation4.AnimationId = 'rbxassetid://' .. CrouchLeft
local animation5 = Instance.new("Animation")
animation5.AnimationId = 'rbxassetid://' .. CrouchRight
-- Crawling animation finder
local CrawlIdleAnimation = Instance.new("Animation")
CrawlIdleAnimation.AnimationId = 'rbxassetid://' .. CrawlIdle
local CrawlAnimation = Instance.new("Animation")
CrawlAnimation.AnimationId = 'rbxassetid://' .. CrawlingId
-- crouch animation tracks
local animationTrack = humanoid:WaitForChild("Animator"):LoadAnimation(animation)
animationTrack.Priority = Enum.AnimationPriority.Idle
local animationTrack2 = humanoid:WaitForChild("Animator"):LoadAnimation(animation2)
animationTrack2.Priority = Enum.AnimationPriority.Action
local animationTrack3 = humanoid:WaitForChild("Animator"):LoadAnimation(animation3)
animationTrack3.Priority = Enum.AnimationPriority.Action
local animationTrack4 = humanoid:WaitForChild("Animator"):LoadAnimation(animation4)
animationTrack4.Priority = Enum.AnimationPriority.Action
local animationTrack5 = humanoid:WaitForChild("Animator"):LoadAnimation(animation5)
animationTrack5.Priority = Enum.AnimationPriority.Action
-- crawl animation tracks
local animationTrack6 = humanoid:WaitForChild("Animator"):LoadAnimation(CrawlIdleAnimation)
animationTrack.Priority = Enum.AnimationPriority.Idle
print("found track 6")
local animationTrack7 = humanoid:WaitForChild("Animator"):LoadAnimation(CrawlAnimation)
animationTrack.Priority = Enum.AnimationPriority.Action
print("Track 7")
local crouching = false
local crawling = false
local canCrawl = false
--// Functions
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode[Crouch] then
if crouching then
humanoid.WalkSpeed = 16
crouching = false
animationTrack:Stop()
animationTrack6:Stop()
animationTrack7:Stop()
canCrawl = false
crawling = false
character.HumanoidRootPart.CanCollide = true
print("Standing")
else
humanoid.WalkSpeed = 7
crouching = true
canCrawl = true
animationTrack:Play()
character.HumanoidRootPart.CanCollide = false
print("Crouching")
end
end
if input.KeyCode == Enum.KeyCode[Crouch] then
if crawling == true then
crawling = false
animationTrack:Play()
animationTrack6:Stop()
animationTrack7:Stop()
end
end
if input.KeyCode == Enum.KeyCode[CrouchF] then
if crouching == true and crawling == false then
animationTrack2:Play()
animationTrack:Stop()
print("CrouchingForward")
end
end
if input.KeyCode == Enum.KeyCode[CrouchB] then
if crouching == true and crawling == false then
animationTrack3:Play()
animationTrack:Stop()
print("backing up")
end
end
if input.KeyCode == Enum.KeyCode[CrouchL] then
if crouching == true and crawling == false then
animationTrack4:Play()
animationTrack:Stop()
print("crouching left")
end
end
if input.KeyCode == Enum.KeyCode[CrouchR] then
if crouching == true and crawling == false then
animationTrack5:Play()
animationTrack:Stop()
print("Crouching Right")
end
end
if canCrawl == true then
if input.KeyCode == Enum.KeyCode[Crawl] then
if crawling == false then
crawling = true
animationTrack:Stop()
animationTrack6:Play()
print("Crawling")
else
animationTrack:Play()
animationTrack6:Stop()
print("Crouching")
crawling = false
end
end
end
if crawling == true and crouching == false then
if input.KeyCode == Enum.KeyCode[CrouchF] or input.KeyCode == Enum.KeyCode[CrouchB] or input.KeyCode == Enum.KeyCode[CrouchL] or input.KeyCode == Enum.KeyCode[CrouchR] then
animationTrack7:Play()
animationTrack6:Stop()
animationTrack:Stop()
print("Crawling")
end
end
if crawling == false and crouching == false then
print("Standing")
animationTrack:Stop()
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.KeyCode == Enum.KeyCode[CrouchF] or input.KeyCode == Enum.KeyCode[CrouchB] or input.KeyCode == Enum.KeyCode[CrouchL] or input.KeyCode == Enum.KeyCode[CrouchR] then
if crouching == true and crawling == false then
animationTrack:Play()
animationTrack2:Stop()
animationTrack3:Stop()
animationTrack4:Stop()
animationTrack5:Stop()
print("Crouching")
end
end
if crawling == true and crouching == false then
if input.KeyCode == Enum.KeyCode[CrouchF] or input.KeyCode == Enum.KeyCode[CrouchB] or input.KeyCode == Enum.KeyCode[CrouchL] or input.KeyCode == Enum.KeyCode[CrouchR] then
animationTrack7:Stop()
animationTrack6:Play()
animationTrack:Stop()
print("laying down")
end
else
if crouching == true and crawling == false then
print("Crouching")
animationTrack:Play()
animationTrack7:Stop()
animationTrack6:Stop()
end
end
end)