Run/Walk not blending in roblox rigs based on WalkSpeed like in player characters

I want to blend the run/walk animations dynamically for my custom rigs and was trying to understand how the default blending works for walking and running (in R15 block rigs).

I pasted the local Animate script into a server script and the animations worked, next step was changing WalkSpeed to 3 on the server side to see the rig will respond and AdjustWeight of it’s walk and run animations to be more walky looking to match the speed.

Unfortunately it didn’t work and the rig proceeded to play the run animation, but slower (even though it uses the exact same script as my character, and my character walks when I lower the WalkSpeed).

To me it seems like a server-client thing where weight adjustment isn’t registered or something but I can’t put a finger on it. I’ve also tried playing it locally by placing the same script into StarterPlayerScripts but that yields the exact same result.

Also tried changing RunContext to client but still doesn’t work.

Here is the movement script I am using, don’t mind me using a part, that’s dual purpose for other IK stuff.

local target = game.Workspace:WaitForChild("TargetPart")

local rig = script.Parent
local humanoid = rig:FindFirstChildOfClass("Humanoid")



if humanoid and target then
	while true do
		local newPosition = Vector3.new(
			math.random(-50, 50),
			5,
			math.random(-50, 50)
		)
		target.Position = newPosition

		humanoid:MoveTo(target.Position)

		task.wait(10)
	end
end

Here is the default “-- humanoidAnimateR15Moods.lua” script part that is supposed to be in charge of all these blending operations (I think).

local function setRunSpeed(speed)
	local normalizedWalkSpeed = 0.5 -- established empirically using current `913402848` walk animation
	local normalizedRunSpeed  = 1
	local runSpeed = rootMotionCompensation(speed)

	local walkAnimationWeight = smallButNotZero
	local runAnimationWeight = smallButNotZero
	local timeWarp = 1

	if runSpeed <= normalizedWalkSpeed then
		walkAnimationWeight = 1
		timeWarp = runSpeed/normalizedWalkSpeed
	elseif runSpeed < normalizedRunSpeed then
		local fadeInRun = (runSpeed - normalizedWalkSpeed)/(normalizedRunSpeed - normalizedWalkSpeed)
		walkAnimationWeight = 1 - fadeInRun
		runAnimationWeight  = fadeInRun
	else
		timeWarp = runSpeed/normalizedRunSpeed
		runAnimationWeight = 1
	end
	currentAnimTrack:AdjustWeight(walkAnimationWeight)
	runAnimTrack:AdjustWeight(runAnimationWeight)
	currentAnimTrack:AdjustSpeed(timeWarp)
	runAnimTrack:AdjustSpeed(timeWarp)
end

Please give me an idea of what the problem is on the concept level if you can, and I can probably figure out the rest. :pray:

Idk why it wasn’t working, I spawned a new rig, swapped it’s localScript for a server script, commented the chatHook, changing the walkSpeed to 3 before starting the game. The animations are blending fine now.

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