So I am trying to adjust the speed of my animations but the moment I play the animation after adjusting it goes back to default speed. Here is the script:
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local animator = humanoid:WaitForChild("Animator")
local skill1 = humanoid:LoadAnimation(script.skill1)
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.KeypadOne then
skill1:AdjustSpeed(10)
print(skill1.Speed) --Here it prints 10 as expected
skill1:Play()
print(skill1.Speed) --Now here it prints 1 meaning that it was set back to 1 instead of 10
skill1.Stopped:Wait()
print("Finished")
end
end)
AdjustSpeed() must be after :Play (), what’s the point of this? I do not know, is that, or when you use the script again, the speed goes back to the original.
And you must use Animator to load the animation.
You are right, I need to adjust speed after playing, I didn’t consider that because in the API itself it shows a function that plays after adjusting. Also, I loaded it to the humanoid just to check if it was the issue somehow.
Yeah, they might have overlooked this because now I have to completely change my script to adjust only after playing the animation instead of adjusting it beforehand.
It’s rather odd to be honest, because it’s like setting a variable to another value then when you call it, it gets set back to the previous value. That wouldn’t make much sense.