Custom rig rotates and clips to floor when animation is played

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("Snowball")
	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
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.AutomaticScalingEnabled = false
	end)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.