I want to know to make an animation for running
Well, I don’t think this is the Correct place for that
Put this under #help-and-feedback:art-design-support
thank you anyway for trying to help
1 Like
Well, first you would have to create a running animation, and then, it would be best to detect when the players X and Z velocity is your running speed, and play the animation.
It would also be good to adjust the speed of the animation to match the walkspeed.
Given code would be in a local script, by the way.
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local Humanoid_RP = Character:WaitForChild("HumanoidRootPart")
local Anim = -- [ path to animation ]
local RunService = game:GetService("RunService")
local RunAnimation = Animator:LoadAnimation(Anim)
local RunningSpeed = 25 -- Change 25 to be your desired walkspeed for the animation to play
function PlayAnimation()
RunAnimation:AdjustSpeed((Humanoid.WalkSpeed/RunningSpeed) * (Humanoid_RP.Velocity.Magnitude / RunningSpeed))
if Vector3.new(Humanoid_RP.Velocity.X, 0, Humanoid_RP.Velocity.Z).Magnitude > RunningSpeed / 1.5 and not RunAnimation.IsPlaying then
RunAnimation:Play()
elseif Vector3.new(Humanoid_RP.Velocity.X, 0, Humanoid_RP.Velocity.Z).Magnitude < RunningSpeed / 1.5 then
RunAnimation:Stop()
end
end
RunService.RenderStepped:Connect(PlayAnimation)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.