I have a problem where I need to animate the player crawling. I’ve bound it to a key and tried it and visually it looks fine. The problem is that my character will not go through the crawlspace due to HumanoidRootPart.
I know you cannot animate the HumanoidRootPart whatsoever, so what common practices are used in order to get around this?
From what I can tell the posts about this topic seem to be pretty scarce.
Okay, so I attempted to use HipHeight to move the players root part down. This caused me to glitch into the floor. I can’t seem to find many solutions online on how to use this property properly.
Hello, i have made a crawl system before in the past. Keep in mind it is not the best, i have not worked on this in a while but it still works as far as i know.
Local script, goes into StarterCharacterScripts:
local player = game.Players.LocalPlayer
down = false -- this is the variable for crouching, we will use this to see if the player is crouching or
- not
local Humanoid = player.Character:FindFirstChild('Humanoid')
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.C then -- after pressing "C" the crouch function will begin
if down == false then -- checking to see if the player isn't already crouched
local Animation = Instance.new("Animation", player.Character) -- Creats a new animation
Animation.AnimationId = "rbxassetid://ANIMATIONIDHERE" -- you will put your animation id code t
-- here
Animate = Humanoid:LoadAnimation(Animation) -- loads the animation
Animate:Play() -- plays the animation
Humanoid.WalkSpeed = 8
down = true
end
end
end)
UIS.InputBegan:Connect(function(input,gameProccesedEvent)
if input.KeyCode == Enum.KeyCode.LeftControl then -- when left ctrl is pressed the get up
-- function will begin
if down == true then -- checks if player is crouched
Animate:Stop() -- stops the animation
Humanoid.WalkSpeed = 16
down = false
end
end
end)
The humanoidRootPart serves as an anchor from which to animate the player from, so this cannot be animated im pretty sure. One thing you can do is make sure the humanoidRootPart is as tall as the player would be when they are crawling. Then, you can have the HipHeight offset the player from the ground a sufficient amount to make it appear as they are standing. Once you want the player to crawl, set the HipHeight to half the height of the HumanoidRootPart to bring them down to a crawl. (To prevent glitching, i recommend you have your HumanoidRootPart’s CanCollide property set to true, unless there is any reason you may have for it to be otherwise)
I ended up setting the HRP’s CanCollide to false instead of moving the HipHeight and it seems to work fine for now. Ill toy around with some other methods if this breaks down, but for now its working perfectly.
In my experience, having no parts in the playerModel with their colliders on and solely relying on hipHeight for collisions has caused problems, but if it works seamlessly for you, then kudos!