Hey everyone! I was thinking of changing the player’s speed depending on their acceleration (just adding up acceleration with percents and both with walkspeed, the run animation should speed up a bit too).
But when i tried to check, the animation instead of being faster, just broke. I did that inside the local script with official roblox animation script. When i change the value to >1, it works fine.
The script:
function adjustRunSpeedAnimation()
local animator:Animator = humanoid.Animator
for i, track:AnimationTrack in animator:GetPlayingAnimationTracks() do
if track.Name ~= "WalkAnim" then continue end
if braking then
track:AdjustSpeed(0.5)
else
track:AdjustSpeed(1.1)
end
end
end
humanoid.StateChanged:Connect(adjustRunSpeedAnimation)
UIS.InputBegan:Connect(function(input, processed)
if processed then return end
if input.UserInputType ~= Enum.UserInputType.Keyboard then return end
if input.KeyCode == Enum.KeyCode.F then
braking = true
brakeRemote:FireServer(true)
end
adjustRunSpeedAnimation()
end)
UIS.InputEnded:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.F then
braking = false
brakeRemote:FireServer(false)
end
adjustRunSpeedAnimation()
end)
And this is what happens while using it:
What is wrong with it? Is it a script or animation issue? Any help is appreviated