How do I make my custom idle animation slower?

I wanted to make my custom idle animation slower. Unfortunately I cant figure out how to slow the animation down though which has me completely stumped since I am only a mediocre scripter.

I tried using :AdjustSpeed() and also tried it after I loaded the animation but it still didn’t work.

This is the script that I am currently using.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		local animator = hum:WaitForChild("Animator")
		for _, track in pairs(animator:GetPlayingAnimationTracks()) do
			track:Stop(0)
		end
		local animScript = char:WaitForChild("Animate")
		animScript.idle.Animation1.AnimationId = script:WaitForChild("Animation").AnimationId
		animScript.idle.Animation1.Weight.Value = 10
		animScript.idle.Animation1:AdjustSpeed(0.5)
	end)
end)
1 Like

What I would recommend you do is import the idle animation through the Roblox animator and adjust the speed using it

image

image

1 Like

I tried it yet the same outcome still comes out, do you have any other ways?

The only other option I can think of is for you to customize Roblox’s own animation script

You can start the test in the studio and get the script

image

After you get the script you put it in startercharacterscripts
for it to replace the roblox default

then you just need to replace a specific part of the Roblox default animator which is the SwitchToAnim function

local function switchToAnim(anim, animName, transitionTime, humanoid)
	-- switch animation		
	if (anim ~= currentAnimInstance) then
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		if (runAnimTrack ~= nil) then
			runAnimTrack:Stop(transitionTime)
			runAnimTrack:Destroy()
			if userNoUpdateOnLoop == true then
				runAnimTrack = nil
			end
		end
	
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		currentAnimTrack.Priority = Enum.AnimationPriority.Core
		
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		
		if animName == "idle" then
			currentAnimSpeed = .5

			currentAnimTrack:AdjustSpeed(.5)
		end
		
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
		
		-- check to see if we need to blend a walk/run animation
		if animName == "walk" then
			local runAnimName = "run"
			local runIdx = rollAnimation(runAnimName)

			runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
			runAnimTrack.Priority = Enum.AnimationPriority.Core
			runAnimTrack:Play(transitionTime)		
			
			if (runAnimKeyframeHandler ~= nil) then
				runAnimKeyframeHandler:disconnect()
			end
			runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)	
		end
	end
end

basically the part that will adjust the speed of the animation is this check

if animName == "idle" then
			currentAnimSpeed = .5

			currentAnimTrack:AdjustSpeed(.5)
		end

you can adjust the values ​​from 0 to 1 to look for an animation speed that looks good

Where is the “specific part” located, also my game is in R6.

line 457

And I could be wrong but from what I remember there is no difference between the standard r6 and r15 animators

Are you sure?

ok maybe it will take me a while because I’m not used to the r6 animator but I’ll find a way to change the speed

1 Like

replace the playAnimation function on line 237

function playAnimation(animName, transitionTime, humanoid) 
		
	local roll = math.random(1, animTable[animName].totalWeight) 
	local origRoll = roll
	local idx = 1
	while (roll > animTable[animName][idx].weight) do
		roll = roll - animTable[animName][idx].weight
		idx = idx + 1
	end
--		print(animName .. " " .. idx .. " [" .. origRoll .. "]")
	local anim = animTable[animName][idx].anim

	-- switch animation		
	if (anim ~= currentAnimInstance) then
		
		if (currentAnimTrack ~= nil) then
			currentAnimTrack:Stop(transitionTime)
			currentAnimTrack:Destroy()
		end

		currentAnimSpeed = 1.0
	
		-- load it to the humanoid; get AnimationTrack
		currentAnimTrack = humanoid:LoadAnimation(anim)
		currentAnimTrack.Priority = Enum.AnimationPriority.Core
		 
		-- play the animation
		currentAnimTrack:Play(transitionTime)
		currentAnim = animName
		currentAnimInstance = anim
		
		if animName == "idle" then
			currentAnimSpeed = .5
			
			currentAnimTrack:AdjustSpeed(.5)
		end

		-- set up keyframe name triggers
		if (currentAnimKeyframeHandler ~= nil) then
			currentAnimKeyframeHandler:disconnect()
		end
		currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
		
	end

end

you can adjust the speed by this value

currentAnimSpeed = .5
			
currentAnimTrack:AdjustSpeed(.5)
1 Like

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