#IDLE ANIMATION NOT WORKING

1 messages · Page 1 of 1 (latest)

devout lava
#

the idle animation should be that the zombie is standing still but it kept doing the running animation help

#

local animator = script.Parent:WaitForChild("Humanoid"):WaitForChild( "Animator")

local attackanim = script:WaitForChild("attackanim")
local attackanimTrack = animator:LoadAnimation(script:WaitForChild("attackanim"))

local runanimTrack = animator:LoadAnimation(script:WaitForChild("runanim"))
local idleanimTrack = animator:LoadAnimation(script:WaitForChild("idleanim"))

local range = script.Parent:WaitForChild("range")

local zomhum = script.Parent:WaitForChild("Humanoid")

if zomhum.WalkSpeed > 0 then
if idleanimTrack.IsPlaying then idleanimTrack:Stop() end
runanimTrack.Looped = true

runanimTrack:Play()
runanimTrack:AdjustSpeed(4)

elseif zomhum.WalkSpeed == 0 then
if runanimTrack.IsPlaying then runanimTrack:Stop() end

idleanimTrack.Looped = true
idleanimTrack:Play() 

end

stone tapir
#

did you set its walkspeed to 0

#

WalkSpeed is constant, it doesnt change to 0 even if its not moving

devout lava
#

so how do i know when a bot stopped moving

stone tapir
#

probably by checking the primaryparts Velocity.Magnitude

#
green burrow
#

humanoid.MoveDirection

stone tapir
#

yea thats probably easier

devout lava
green burrow
#

use magnitude

devout lava
#

so how do i know if something stopped

green burrow
#

compare the magnitude

devout lava
#

so i use it like

if humanoid.WalkSpeed > insert magnitude here then
execute this script

#

im not familiar with MoveDirection..

green burrow
#

movedirection is a property of humanoid and holds a vector3 value, magnitude is the length of the vector3.

little shoreBOT
#

studio** You are now Level 11! **studio

green burrow
#

compare the magnitude

#

if moveidrection.magnitude < 0

devout lava
#

are there any posts/videos about this i think i needa learn abt it

green burrow
#

search it

stone tapir
little shoreBOT
#

studio** You are now Level 4! **studio

devout lava
#

okay ty