#Run animation for morph

1 messages · Page 1 of 1 (latest)

lilac needle
#

so i have that script for morph and inside there is this line who doesn't work, for exemple i put the walk speed to 15 and use a run script to change the speed to higher that 16 but for some reason, the run animation only play for like 0.1 sec, how can i fix it?

#

to let you know that all of the other animation work but only the run is bugged

hallow panther
#
function onRunning(speed)
  print("function")
  if speed > 0.01 then
    print("walking")
    playAnimation("walk", 0.1, script.Parent.Humanoid)
  elseif speed > 16 then
      print("running")
      playAnimation("run", 0.1, script.Parent.Humanoid)
      pose = "Running"
    end
  else
    print("idling")
    playAnimation("idle", 0.1, script.Parent.Humanoid)
    pose = "Standing"
  end
end

Im stupid btw this probably wont work im sure you had a good reason why you didnt use an elseif let me know if this works - i tried looking though the rest of the script but anyways a good way to test is also adding in a heap of print statements to double check which exact part is broken

lilac needle
#

there is a problem with the "else"

hallow panther
#

remove end

lilac needle
#

ok

hallow panther
#

my bad

#

put tabs after else idk why the code doesnt copy over properly lol

lilac needle
#

and it doesnt print running

hallow panther
#
function onRunning(speed)
  print("function")
  if speed > 0.01 then
    print("walking")
    playAnimation("walk", 0.1, script.Parent.Humanoid)
  elseif speed > 16 then
    print("running")
    playAnimation("run", 0.1, script.Parent.Humanoid)
    pose = "Running"
  else
    print("idling")
    playAnimation("idle", 0.1, script.Parent.Humanoid)
    pose = "Standing"
  end
end
#

this should work better

#

maybe

#

depends

lilac needle
#

still doesnt having the running printing

hallow panther
#
function onRunning(speed)
  print("function")
  if speed > 0.01 and speed < 16 then -- added this???
    print("walking")
    playAnimation("walk", 0.1, script.Parent.Humanoid)
    pose = "Walking" -- why missing this in your original code too i added cuz it seemed right
  elseif speed > 16 then
    print("running")
    playAnimation("run", 0.1, script.Parent.Humanoid)
    pose = "Running"
  else
    print("idling")
    playAnimation("idle", 0.1, script.Parent.Humanoid)
    pose = "Standing"
  end
end
lilac needle
#

okay its different

#

but same as the first thing

hallow panther
#

im just trying to help but i've only been coding for like 6 months - so i can be pretty stupid

lilac needle
#

it only plays for 0.1 sec

hallow panther
#

hmmmm set it to longer

playAnimation("run", 5, script.Parent.Humanoid) --5 seconds might be too long
#

also remove this

pose = "Walking" -- why missing this in your original code too i added cuz it seemed right

i added that lol might actually break your code

lilac needle
#

it still print the run but still doesnt work

hallow panther
#

send screenshot of the code you have currently

lilac needle
hallow panther
#
function move(time)
  local amplitude = 1
  local frequency = 1
  local deltaTime = time - lastTick
  lastTick = time

  local climbFudge = 0
  local setAngles = false

  if (jumpAnimTime > 0) then
    jumpAnimTime = jumpAnimTime - deltaTime
  end

  if (pose == "FreeFall" and jumpAnimTime <= 0) then
    playAnimation("fall", fallTransitionTime, script.Parent.Humanoid)
  elseif (pose == "Seated") then
    playAnimation("sit", 0.5, script.Parent.Humanoid)
    return

  --Does this have anything to do with the issue?
  elseif (pose == "Running") then
    playAnimation("walk", 0.1, script.Parent.Humanoid)


  elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or --...
    --              print("Wha " .. pose)
    stopAllAnimations()
    amplitude = 0.1
    frequency = 1
    setAngles = true
  end
#

you have the animation run here aswell

#

not sure if this is linked

lilac needle
#

wait where do i put it?

limpid skiffBOT
#

studio** You are now Level 2! **studio

hallow panther
#

im not sure ive never coded animations like this but i assume what you're trying to do is
when the player runs

Humanoid.Running:connect(onRunning)

it runs the code

function onRunning(speed)
  print("function")
  if speed > 0.01 and speed < 16 then
    print("walking")
    playAnimation("walk", 0.1, script.Parent.Humanoid)
  elseif speed > 16 then
    print("running")
    playAnimation("run", 0.1, script.Parent.Humanoid)
    pose = "Running" --This here
  else
    print("idling")
    playAnimation("idle", 0.1, script.Parent.Humanoid)
    pose = "Standing"
  end
end

but also when this runs

while Figure.Parent~=nil do
  local _, time = wait(0.1)
  move(time)
end

it also runs

elseif (pose == "Running") then
  playAnimation("walk", 0.1, script.Parent.Humanoid)
lilac needle
#

oh

#

:O

#

OMG so

#

i changed the "walk" to "run"

#

AND ITS WORKING

hallow panther
#

yay

lilac needle
#

small problem

#

if i stop running while moving it will continue the run animation until i stop

hallow panther
#

no joke i spent 4 hours looking over the same code and asked someone in here just for it to be spotted within 10 seconds by some random and it was exactly like this like some tiny error i missaw

lilac needle
#

I ALSO MANAGE TO FIX THIS PROBLEM

hallow panther
#

yay heck yeah dude

lilac needle
#

i just had to remove that line

#

that code line was the imposter

#

now i will lurk for a crawl animation

#

i mean a crawl script

hallow panther
#

good luck with your game dude im happy i could help even a little bit. im still waiting for someone to help with my code issue