How do i change the WalkSpeed at which the Walk animation starts playing?

Hi, so, i’m pretty sure that the walk animation of the character plays only if the walkspeed lower than a specific number, right? (Correct me if i’m wrong.) I’m wondering how do i raise that walkspeed, because i have a script that builds up the speed of the player, and so the player starts out moving slowly, but still with the run animation, so it looks a bit odd. Idk if this is something you can modify in the Animate script orrr. Please help!

This codes might help you:

function onRunning(speed)
	local heightScale = if userAnimateScaleRun then getHeightScale() else 1
	
	local movedDuringEmote = currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
	local speedThreshold = movedDuringEmote and (Humanoid.WalkSpeed / heightScale) or 0.75
	if speed > speedThreshold * heightScale then
		local scale = 16.0
		playAnimation("walk", 0.2, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
			playAnimation("idle", 0.2, Humanoid)
			pose = "Standing"
		end
	end
end
1 Like

Yo i found a thread that might help you

1 Like

Thanks, i messed around with it and found a solution. But, i have another issue now, in my run and walk animations i have markers for footstep sound effects, and since the walk and run animations seemingly play simultaneously, the footstep sounds are all messed up. Here’s what i mean:

Here’s the code if needed:

local function Footsteps(Anim : AnimationTrack)
    if (Anim.Name == "WalkAnim" or Anim.Name == "RunAnim") and not CSettings:GetAttribute("Skidding") then
        Anim:GetMarkerReachedSignal("Step"):Connect(function()
            if CSettings:GetAttribute("Skidding") == false  then
                local CurrentMaterial = Humanoid.FloorMaterial
                --------------------------------------
                for _, Step in Torso:GetChildren() do
                    if Step:IsA("Sound") and Step.Playing then
                        Step:Stop()
                    end
                end
                --------------------------------------
                local Material = CurrentMaterial.Name
                local Sound = Torso:FindFirstChild(Material)
                --------------------------------------
                if Sound then
                    Sound.PlaybackSpeed = math.random(9, 11)/10
                    --------------------------------------
                    Sound:Play()
                end
            end
        end)
    end
end
Animator.AnimationPlayed:Connect(Footsteps)

EDIT: Nvm, i solved it.

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