You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I wanted to play around with custom run and walk animations but I encountered this weird issue. Also I made the custom walk animation by forking the Animate script from the player’s character and replacing the walk animation’s AnimationId for my custom one.
- What is the issue? Include screenshots / videos if possible!
As you can see in the video below when starting the run animation or ending the animation the avatar’s arms begin to sometimes bug out.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked on the devforum but I didnt find a solution to a problem like this.
Here’s the script responsible for playing the run animation:
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local currentCamera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://11734934044"
local LoadedAnim = humanoid:WaitForChild("Animator"):LoadAnimation(Anim)
LoadedAnim.Priority = Enum.AnimationPriority.Movement
local sprintSpeed = {
["A"] = {
WalkSpeed = 50
},
["B"] = {
WalkSpeed = 16,
}
}
local FOVgoal = {
["A"] = {
FieldOfView = 90
},
["B"] = {
FieldOfView = 70
}
}
local TI = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
UIS.InputBegan:Connect(function(input, gameprocess)
if not gameprocess then
if input.KeyCode == Enum.KeyCode.LeftShift and humanoid.MoveDirection.Magnitude > 0 then
local SpeedTween = TweenService:Create(humanoid, TI, sprintSpeed["A"]):Play()
local FOVtween = TweenService:Create(currentCamera, TI, FOVgoal["A"]):Play()
LoadedAnim:Play(1)
end
end
end)
UIS.InputEnded:Connect(function(input, gameprocess)
if not gameprocess then
if input.KeyCode == Enum.KeyCode.LeftShift then
local SpeedTween = TweenService:Create(humanoid, TI, sprintSpeed["B"]):Play()
local FOVtween = TweenService:Create(currentCamera, TI, FOVgoal["B"]):Play()
LoadedAnim:Stop(0.5)
end
end
end)