Stuttering in animation and HumanoidRootPart isn't moving during animation

So I have this just a random game made because I was just bored that’s extremely similar to the popular game Rogue Lineage and I was testing with an animation that goes into the ground which is a decompose-like animation but when the animation plays, the HumanoidRootPart is just still and for some reason, the animation sort of stutters when you go up back out the ground. Plus, the arms of the player are normal like the ROBLOX idle animation instead of the arm position in the animation.

Since if you anchor the HumanoidRootPart, an animation won’t play so I thought that it would freeze the animation in its position but it didn’t work since the player’s doing the idle animation instead of the decompose animation. It is supposed to just stay in the decompose animation.

animation and how it works: https://streamable.com/z01gmc

tool local script:

local player = game.Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local Torso = character:WaitForChild("Torso")

local tool = script.Parent

local ScroomDecomposeDown = Instance.new("Animation", character)
ScroomDecomposeDown.Name = "ScroomDecomposeDown"
ScroomDecomposeDown.AnimationId = "rbxassetid://5700277977"

local ScroomDecomposeUp = Instance.new("Animation", character)
ScroomDecomposeUp.Name = "ScroomDecomposeUp"
ScroomDecomposeUp.AnimationId = "rbxassetid://5700288886"

local animationTrack1
local animationTrack2

local PhysicsService = game:GetService("PhysicsService")

animationTrack1 = humanoid:LoadAnimation(ScroomDecomposeDown)
animationTrack2 = humanoid:LoadAnimation(ScroomDecomposeUp)

local isDecomposed = false

tool.Activated:Connect(function()
	if humanoid.FloorMaterial ~= Enum.Material.Air and humanoid.FloorMaterial == Enum.Material.Grass and not animationTrack1.IsPlaying and not isDecomposed then
		humanoid.WalkSpeed = 0
		
		animationTrack1:Play()
		
		Torso.CanCollide = false
		HumanoidRootPart.CanCollide = false
		
		wait(2.8)
		
		for i, v in pairs(character:GetChildren()) do
			if v:IsA("BasePart") and not v.Name == "Connector" then
				v.Anchored = true
				v.CanCollide = false
			end
		end
		
		local Connector = character.Connector
		
		local WeldConstraint = Instance.new("WeldConstraint")
		WeldConstraint.Parent = Torso
		WeldConstraint.Part0 = Torso
		WeldConstraint.Part1 = Connector
		
		HumanoidRootPart.Anchored = true
		Torso.Anchored = true
		
		Connector.Anchored = true
		isDecomposed = true
		
	elseif isDecomposed == true and not animationTrack2.IsPlaying then
		character.Torso.WeldConstraint:Destroy()
		
		for i, v in pairs(character:GetChildren()) do
			if v:IsA("BasePart") then
				v.Anchored = false
			end
		end
		
		animationTrack2:Play()
		
		wait(1.8)
		
		humanoid.WalkSpeed = 16
	
		character.Connector.Anchored = false
		isDecomposed = false
	end
end)

I have also have a script that uses RunService to keep the player’s HumanoidRootPart and Torso’s CanCollide to false so the player can decompose into the ground.

runservice script:

local RunService = game:GetService("RunService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
local Torso = character:WaitForChild("Torso")

RunService.Stepped:Connect(function()
     HumanoidRootPart.CanCollide = false
     Torso.CanCollide = false
end)

The humanoidRootPart cant be animated by a animation.

2 Likes