Custom Rig Collisions Being Extremely Glitchy

Issue with custom rig collisions and animations
I made custom animations and had my friend help me set them up using a script (I’ll show it below). The collisions from the custom rig are really strange. Whenever the player steps on an elevated or lowered part/mesh, the animation rapidly replays. I’m still not sure if the problem lies within the script, the animations, or the rig itself. I’ve attached samples of each as well as a video of the problem. Thanks in advance!

Script
Chicken.__index = Chicken

local Player = game.Players.LocalPlayer

local ChickenState = Player:WaitForChild("gamestats"):WaitForChild("ChickenState");

local Bindables = game:GetService("ReplicatedStorage").Bindables

local Events = game:GetService("ReplicatedStorage").Remotes.Events

local debounce = false
local jumping = false

local inputConnection
local floorConection
local runConnection
local chickenStateConnection

local ChickenAnims = {
    ["Default Chicken"] = {
        IDLE_ANIM = "rbxassetid://5633571340";
        PECK_ANIM = "rbxassetid://6021681847";
        WALK_ANIM = "rbxassetid://6020995785";
        JUMP_ANIM = "rbxassetid://6115932007";
        ATTACK_ANIM = "rbxassetid://5634799390";
    };
    ["Ghost Chicken"] = {
        IDLE_ANIM = "rbxassetid://5633571340";
        PECK_ANIM = "rbxassetid://6021681847";
        WALK_ANIM = "rbxassetid://6088950639";
        JUMP_ANIM = "rbxassetid://6115932007";
        ATTACK_ANIM = "rbxassetid://5634799390";
    };
    ["Zombie Chicken"] = {
        IDLE_ANIM = "rbxassetid://6115879796";
        PECK_ANIM = "rbxassetid://6021681847";
        WALK_ANIM = "rbxassetid://6115856356";
        JUMP_ANIM = "rbxassetid://6115932007";
        ATTACK_ANIM = "rbxassetid://5634799390";
    }
}

function Chicken.new()
    local self = setmetatable({}, Chicken)

    Events.PlayerModelChanged.OnClientEvent:Connect(function()
        self.Humanoid = Player.Character.Humanoid
        self.Character = Player.Character
        self:loadAnimations()
        jumping = false
    end)

    return self
end

function Chicken:loadAnimations()
    
    if inputConnection then inputConnection:Disconnect() end
    if floorConection then floorConection:Disconnect() end
    if runConnection then runConnection:Disconnect() end
    if chickenStateConnection then chickenStateConnection:Disconnect() end

    local Animator = self.Humanoid:FindFirstChildOfClass("Animator", true)

    local CurrentChicken = Player:WaitForChild("leaderstats"):WaitForChild("PlayerStats").CurrentChicken.Value

    local animation = Instance.new("Animation")
    animation.AnimationId = ChickenAnims[CurrentChicken].WALK_ANIM

    local idleAnimation = Instance.new("Animation")
    idleAnimation.AnimationId = ChickenAnims[CurrentChicken].IDLE_ANIM

    local jumpAnimation = Instance.new("Animation")
    jumpAnimation.AnimationId = ChickenAnims[CurrentChicken].JUMP_ANIM

    local peckAnimation = Instance.new("Animation")
    peckAnimation.AnimationId = ChickenAnims[CurrentChicken].PECK_ANIM

    local attackAnimation = Instance.new("Animation")
    attackAnimation.AnimationId = ChickenAnims[CurrentChicken].ATTACK_ANIM

    local AnimController = Animator:LoadAnimation(animation)
    AnimController.Priority = Enum.AnimationPriority.Idle
    AnimController.Looped = true

    local IdleAnimController = Animator:LoadAnimation(idleAnimation)
    IdleAnimController.Priority = Enum.AnimationPriority.Idle
    IdleAnimController.Looped = true

    local PeckAnimController = Animator:LoadAnimation(peckAnimation)
    PeckAnimController.Priority = Enum.AnimationPriority.Action
    PeckAnimController.Looped = false

    local JumpAnimController = Animator:LoadAnimation(jumpAnimation)
    JumpAnimController.Priority = Enum.AnimationPriority.Action
    JumpAnimController.Looped = false

    local AttackAnimController = Animator:LoadAnimation(attackAnimation)
    AttackAnimController.Priority = Enum.AnimationPriority.Action
    AttackAnimController.Looped = false

    self.JumpAnimController = JumpAnimController
    self.PeckAnimController = PeckAnimController
    self.AttackAnimController = AttackAnimController

    local animSpeed = 1
    local defaultSpeed = 1

    if CurrentChicken == "Zombie Chicken" then
        animSpeed = 2
        defaultSpeed = 2
    end

    chickenStateConnection = ChickenState.Changed:Connect(function(newValue)
        if newValue == 2 then
            animSpeed = animSpeed * 1.35 
        else
            animSpeed = defaultSpeed
        end
    end)
    if ChickenState.Value == 2 then
        animSpeed = animSpeed * 1.35 
    else
        animSpeed = defaultSpeed
    end
    

    runConnection = self.Humanoid.Running:Connect(function(speed)
        if speed > 5 then
            AnimController:Play(nil, nil, animSpeed)
            IdleAnimController:Stop()
        else
            AnimController:Stop()
            IdleAnimController:Play()
        end
    end)

    inputConnection = game:GetService("UserInputService").InputBegan:Connect(function(input, gameProccessedEvent)
        if input.KeyCode == Enum.KeyCode.Space and not gameProccessedEvent then
            if not jumping then
                jumping = true
                self.JumpAnimController:Play()
                self.Character.HumanoidRootPart.Velocity = Vector3.new(0, 10, 0)
            end
        end
    end)

        
    floorConection = self.Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
        if self.Humanoid.FloorMaterial ~= Enum.Material.Air then
            jumping = false
        end
    end)
end

function Chicken:peck()
    if debounce == false then
        debounce = true
        self.PeckAnimController:Play()
        self.PeckAnimController.Stopped:Wait()
        debounce = false
        return true
    end
end

function Chicken:attack()
    if debounce == false then
        debounce = true
        self.PeckAnimController:Play(0.1, 1, 2) 
        Bindables.AttackBegan:Fire()
        self.PeckAnimController.Stopped:Wait()
        Bindables.AttackEnded:Fire()
        debounce = false
    end
end

return Chicken```
Humanoid Root Part Settings

3 Likes

Have you tried putting prints in to enable you to see the path the logic is taking?

3 Likes

You could try to set the HumanoidRootPart Can-Collide to False

Also make sure the body parts of the rig are set to Can-Collide False EXCEPT for the Main body or legs?

Try to switch the Can-Collide on and off between the HumanoidRootRart and main body.

NOTE: The CollisionFidelity for the main body should be set to default or better if you want precise collision.

3 Likes

hi, i am the scripter on this project and want to say yes but thats not the issue since the animations are playing fine its just getting stopped.

Adjusting the HipHeight might help, it seems like the bottom of your humanoidrootpart is sliding on the ground which is causing the velocity of your character to get jacked up which is causing your animation script to freak out.

1 Like

Thanks so much! Turning CanCollide on for the humanoid root part actually fixed it. We still have no idea why.

1 Like

Glad It worked, I’ve encountered similar Issues. :grinning:

1 Like