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)
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
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
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