Making an rpg and need a way to make the players running animation play when they start moving and their idle animation to play when they stop. The script is in a local script and the animations are already loaded in.
local player = game.Players.LocalPlayer
local Character = script.Parent
local RootPart = Character:WaitForChild("HumanoidRootPart")
local Movement = RootPart:WaitForChild("Movement") --Movement is a Bodyvelocity bodymover with no scripts
RunPlaying = false
Movement.Changed:connect(function()
if not RunPlaying then
RunPlaying = true
if Movement.Velocity.X ~= 0 and Movement.Velocity.Z ~= 0 then
CurrentRun:play()
end
end
if Movement.Velocity.X == 0 and Movement.Velocity.Z == 0 then
CurrentRun:Stop()
RunPlaying = false
end
end)
My question is pretty much how would I get the bodyvelocity bodymover to be equal to the players velocity?
