Custom rig rotates and clips to floor when animation is played

How it looks like in-game:
robloxapp-20241209-1807162.wmv (715.9 KB)

In Animation Editor:
robloxapp-20241209-1808346.wmv (380.0 KB)

Code:

local isProcessing = false

function hi(player)

	if isProcessing then
		return
	end

	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:FindFirstChild("Humanoid")
	local backpack = player:FindFirstChild("Backpack")
	local itemTemplate = game.ServerStorage:FindFirstChild("наши дети")
	local animation = script:FindFirstChild("CollectSnow")

	for _, item in pairs(backpack:GetChildren()) do
		if item.Name == itemTemplate.Name then
			return 
		end
	end


	isProcessing = true


	local animTrack = humanoid:LoadAnimation(animation)
	animTrack:Play()


	task.wait(3)
	animTrack:Stop()


	local newItem = itemTemplate:Clone()
	newItem.Parent = backpack


	isProcessing = false
end

script.Parent.ClickDetector.MouseClick:Connect(hi)
2 Likes

The problem was in bad positioning during animation, because HumanoidRootPart does not move, the body outweighed it, I put the body a little back from HumanoidRootPart and everything worked out.