I need help on changing the animation’s speed when a humanoid goes faster. I am using the normal animate script and I don’t know how to change the speed. For example: If I change my walkspeed to 100 using any admin source it just plays the walking animation at normal speed.
1 Like
use animationTrack:AdjustSpeed(number)
https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/Speed
You could hardlimit the humanoid’s walkspeed while the animation is playing (if that’s a viable solution for your game).
humanoid.WalkSpeed = 16
You could otherwise change the Speed property of the animation track through the use of the “AdjustSpeed” function. Bare in mind the Speed property is locked and cannot be directly assigned to, only changed through the use of the aforementioned function.
More info here:
https://developer.roblox.com/en-us/api-reference/function/AnimationTrack/AdjustSpeed
do i have to add a certain function for that to work?
I think this shall work…
put in local?
local id = "999999999" -- Animation ID
local player = game:GetService("LocalPlayer")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://" .. id
local animationTrack = humanoid:LoadAnimation(animation)
local function update()
if player.character.humanoid.WalkSpeed == 16 then
animationTrack:AdjustSpeed(.5)
elseif player.character.humanoid.WalkSpeed == 100 then
animationTrack:AdjustSpeed(1)
end
end
3 Likes
It works perfectly fine, I see no errors. Thanks!