Roblox rig animation not playing correctly due to torso collision

I want to create a boss for my own game, I want to play animations in certain situations. But i cannot play animations correctly. First video is made by anchoring rig to place before playing animations, second video made without anchoring.

This is my first time creating a custom rig, I don’t know much about them but i need help. My codes that play animations:

local function Attack01()
if snowman.Events then

	local attack01anim = snowman.Animations:FindFirstChild("Attack01")
	local track = snowman.Humanoid:LoadAnimation(attack01anim)
	track:Play()
	track.Ended:Wait()
	
end

end

local function Attack03()
local closest = getClosestPlayer()
if not closest then return end
if not snowman.Humanoid then return end

local undergroundAnim = snowman.Animations:FindFirstChild("UndergroundAttack")
if not undergroundAnim then return end

freezeSnowman(true)

local track = snowman.Humanoid:LoadAnimation(undergroundAnim)
track:Play()

task.wait(5)

local targetPos = Vector3.new(closest.Position.X, closest.Position.Y, closest.Position.Z)
snowman:SetPrimaryPartCFrame(CFrame.new(targetPos))

track:Stop()
freezeSnowman(false) 

end

local function randomAttack()
local closest = getClosestPlayer()
if not closest then return end
local dist = (torso.Position - closest.Position).Magnitude
if dist > DETECTION_RADIUS then return end

if math.random(1,2) == 1 then
	Attack01()
else
	Attack03()
end

end

What have I tried so far:
Anchoring character.
Forcely disabling collides for Torso but roblox studio enabled it back for not falling into the void.

if you want to disable torso collision, use PhysicsService, heres an example:

local PhysicsService = game:GetService("PhysicsService")
PhysicsService:CreateCollisionGroup("Snowman")
PhysicsService:CollisionGroupSetCollidable("Snowman", "Default", false)

for _, part in pairs(snowman:GetDescendants()) do
    if part:IsA("BasePart") then
        PhysicsService:SetPartCollisionGroup(part, "Snowman")
    end
end
1 Like

i tried this everytime snowman tries to attack with anchoring and it kinda worked. thanks