I am trying to make a crawl animation
The issue is that when I test it in game, the animation doesn’t FULLY play
In studio:
Studio Animation
In game:
in game
I have looked al over the forums but to no luck.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
My code:
local player = script.Parent.Parent
local char = player.Character or player.CharacterAdded:Wait()
local UIS = game:GetService("UserInputService")
local human = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local Animator = human:WaitForChild("Animator")
local isPlaying = false
function createAnims ()
local diveR6 = Instance.new("Animation")
diveR6.AnimationId = "rbxassetid://9313688337"
diveAnimR6 = Animator:LoadAnimation(diveR6)
diveAnimR6.Priority = Enum.AnimationPriority.Movement
diveAnimR6.Looped = true
local diveR15 = Instance.new("Animation")
diveR15.AnimationId = "rbxassetid://9313690927"
diveAnimR15 = Animator:LoadAnimation(diveR15)
diveAnimR15.Priority = Enum.AnimationPriority.Movement
diveAnimR15.Looped = true
local crawlR15 = Instance.new("Animation")
crawlR15.AnimationId = "rbxassetid://9313812390"
crawlAnimR15 = Animator:LoadAnimation(diveR15)
crawlAnimR15.Priority = Enum.AnimationPriority.Action
crawlAnimR15.Looped = true
local crawlR6 = Instance.new("Animation")
crawlR6.AnimationId = "rbxassetid://9313810264"
crawlAnimR6 = Animator:LoadAnimation(diveR15)
crawlAnimR6.Priority = Enum.AnimationPriority.Action
crawlAnimR6.Looped = true
end
createAnims()
human.StateChanged:Connect(function(old,new)
if hrp.Velocity.Y <= -120 then
if old == Enum.HumanoidStateType.Freefall then
if new == Enum.HumanoidStateType.Landed then
hrp.Anchored = true
hrp.Velocity = Vector3.new()
diveAnimR6:Stop()
diveAnimR15:Stop()
wait(0.1)
hrp.Anchored = false
end
end
end
end)
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C then
if human.RigType == Enum.HumanoidRigType.R15 then
crawlAnimR15:Play()
else
crawlAnimR6:Play()
end
end
end)
UIS.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.C then
crawlAnimR15:Stop()
crawlAnimR6:Stop()
end
end)
while wait() do
if hrp.Velocity.Y <= -120 then
if human.FloorMaterial == Enum.Material.Air and human:GetState() == Enum.HumanoidStateType.Freefall and isPlaying == false then
if human.RigType == Enum.HumanoidRigType.R6 then
diveAnimR6:Play()
else
diveAnimR15:Play()
end
isPlaying = true
repeat wait() until human.floorMaterial ~= Enum.Material.Air
isPlaying = false
end
end
end