Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I resize the HumanoidRootPart? [Solved]

Asked by 2 years ago
Edited by JesseSong 2 years ago

I have created a crawl script to make the character crawl through an opening. I created this localscript parented to StarterCharacterScripts.

local UserInputService = game:GetService("UserInputService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Anim = Humanoid:LoadAnimation(script:WaitForChild("CrawlAnim"))
local AlreadyPlaying = false
Humanoid.Running:Connect(function(Speed)
    if Speed>0 then
        Anim:AdjustSpeed(1)
    elseif Speed==0 then
        Anim:AdjustSpeed(0)
    else
        Anim:AdjustSpeed(-1)
    end
end)


UserInputService.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.C then
        if not AlreadyPlaying then
            AlreadyPlaying = true
            Anim:Play()
            Anim:AdjustSpeed(0)
            Humanoid.WalkSpeed = 8
            Humanoid.JumpPower = 0
        else
            Anim:Stop()
            Humanoid.WalkSpeed = 16
            Humanoid.JumpPower = 50
            AlreadyPlaying = false
        end
    end
end)

The problem is that the HumanoidRootPart is blocking the way. Like this. I tried Adding this code to line 5:

coroutine.resume(coroutine.create(function()
    while wait() do
        local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
        local UpperTorso = Character:WaitForChild("UpperTorso")
        HumanoidRootPart.Position = UpperTorso.Position
        HumanoidRootPart.Orientation = UpperTorso.Orientation
        HumanoidRootPart.Size = UpperTorso.Size
    end
end))

Then the character starts going like crazy. How do I fix this?

0
Have you tried setting CanCollide false when crawling? MarkedTomato 810 — 2y
0
Yay It worked! sidb0102 17 — 2y

Answer this question