How can I immediately stop a walk animation when the HumanoidRootPart gets anchored?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to stop a walk animation when I freeze the player by anchoring the HumanoidRootPart.
  2. What is the issue? Include screenshots / videos if possible!
    The issue is in the title. I can’t immediately stop a walk animation since I don’t know how.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I can’t seem to find a solution on the Developer Hub.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Player = game.Players.LocalPlayer
Player.CharacterAdded:Wait()
local Character = Player.Character

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local Camera = workspace.CurrentCamera

local Info1 = TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.In,0,false,0)
local Target1 = {CFrame = workspace.SecondPosition.CFrame}

repeat task.wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = workspace.BeginPosition.CFrame

local Tween1 = TweenService:Create(Camera, Info1, Target1)

local Info2 = TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0)
local Target2 = {CFrame = workspace.FinalPosition.CFrame}
local Tween2 = TweenService:Create(Camera,Info2,Target2)

ReplicatedStorage.Events.BridgeBreak.OnClientEvent:Connect(function()
	Character.Humanoid:WaitForChild("Animator"):LoadAnimation(Character.Animate.idle.Animation1)
	Character.HumanoidRootPart.Anchored = true
	Tween1:Play()
	Tween1.Completed:Wait()
	Tween2:Play()
	Tween2.Completed:Wait()
	ReplicatedStorage.Events.BridgeBreak:FireServer()
end)

ReplicatedStorage.Events.BridgeEnd.OnClientEvent:Connect(function()
	repeat task.wait()
		Camera.CameraType = Enum.CameraType.Custom
	until Camera.CameraType == Enum.CameraType.Custom
	game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
end)

I need to figure a way to stop the animation and anchor the humanoid root part so the player looks like it is frozen in place.

1 Like

You can try to set the PlatformStand property of the humanoid to true. But the character will look like a bowling pin. I guess that’s what you wanted?

Another option it to stop the player first, so it plays the idle animation, then freezing the character.

1 Like

What do you mean by bowling pin?

1 Like

This:

Looks kind of stupid, doesn’t it?

1 Like

I guess that might work. I’ll give it a try and reply back.

3 Likes

The walk sound still plays, I don’t know how to fix that.

1 Like

Are you sure? While I turn on PlatformStand it stops any walking sounds.

Maybe you can try my other option, which is stopping the player first, then freezing them. With this option, you can try setting the WalkSpeed to 0 then freezing them.

1 Like

Like this?

local Player = game.Players.LocalPlayer
Player.CharacterAdded:Wait()
local Character = Player.Character

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")

local Camera = workspace.CurrentCamera

local Info1 = TweenInfo.new(1,Enum.EasingStyle.Circular,Enum.EasingDirection.In,0,false,0)
local Target1 = {CFrame = workspace.SecondPosition.CFrame}

repeat task.wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = workspace.BeginPosition.CFrame

local Tween1 = TweenService:Create(Camera, Info1, Target1)

local Info2 = TweenInfo.new(1.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0)
local Target2 = {CFrame = workspace.FinalPosition.CFrame}
local Tween2 = TweenService:Create(Camera,Info2,Target2)

ReplicatedStorage.Events.BridgeBreak.OnClientEvent:Connect(function()
	Character.Humanoid.WalkSpeed = 0
	Character.Humanoid.PlatformStand = true
	Character.HumanoidRootPart.Anchored = true
	Tween1:Play()
	Tween1.Completed:Wait()
	Tween2:Play()
	Tween2.Completed:Wait()
	ReplicatedStorage.Events.BridgeBreak:FireServer()
end)

ReplicatedStorage.Events.BridgeEnd.OnClientEvent:Connect(function()
	repeat task.wait()
		Camera.CameraType = Enum.CameraType.Custom
	until Camera.CameraType == Enum.CameraType.Custom
	game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
end)
1 Like

Yeah, something like that.

charlimit

1 Like
ReplicatedStorage.Events.BridgeBreak.OnClientEvent:Connect(function()
	Character.Humanoid.WalkSpeed = 0
	Character.Humanoid.PlatformStand = true
	Character.HumanoidRootPart.Anchored = true
	Tween1:Play()
	Tween1.Completed:Wait()
	Tween2:Play()
	Tween2.Completed:Wait()
	ReplicatedStorage.Events.BridgeBreak:FireServer()
end)

The problem is that the walk sound still continues.

1 Like

You can try muting the walking sound, the sounds are in the HumanoidRootPart. Set the volume of the Running sound to 0, then when you want them to move again, set it to 0.65.

1 Like

I don’t see any sounds in the HumanoidRootPart.

1 Like

Screenshot 2025-01-01 at 8.43.21 PM
I entered the game, and checked my HumanoidRootPart, and there were all the sounds. Try this snippet

For muting:

Character.PrimaryPart.Running.Volume = 0

For unmuting:

Character.PrimaryPart.Running.Volume = 0.65

It gives an error stating “Volume cannot be assigned to”

1 Like

Interesting, I tested this snippet out, and it works, are you sure you set it correctly?

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

Character.PrimaryPart.Running.Volume = 0
1 Like

It turns out that the audio was in the Head. In the script, the Camera type is Scriptable, but when converting it back to Custom, it goes to the right of the player.

1 Like

What do you mean by to the right of the player? Does the camera have an offset, or something else?

1 Like

The HumanoidRootPart has an offset to the right of the player. How do you reset it back?

Can I see a screenshot/Video?

Charlimit


Part there is the HumanoidRootPart, and the camera on the Custom type is offsetted to that part.