Running animation acting strange

I am trying to make a run animation that looks like the player is swimming. :face_with_monocle:

The problem is that since the animation is horizontal it looks like the game is switching between vertical and horizontal. Here is a video:

Here is the video of the actual swim animation. (Don’t mind if it’s bad) :sweat_smile:.

I also have a regular run animation. How the script works is that when you spawn in your run animation is set to my running animation and when you touch a part (which is the ocean) it changes the run animation to a swimming animation and then once you stop touching the part it goes back to the regular run animation. Here is the script:


Here is a video of the testing:

I tried searching up how to do this and watching youtube videos on how to create a running animation but nothing really worked for me.

I also have another problem which is that the same animation always plays if your holding down the key so if you go on land but keep on holding the same key it will always play swimming animation until you let go of the key.

Thank you for the help. :grinning:

Inside the animator, try setting the animation priority to Action2.

1 Like

Hi!
Have you taken into account, that HumanoidRootPart will change orientation when swimming, when you made your swimming animation?

1 Like

No, I didn’t is there any way to fix that?

I cannot remember if you can rotate the HumanoidRootPart in the animation editor, otherwise redo it quick. The HumanoidRootPart will rotate 90 degrees when swimming

But if I change the swim animation it may not work because the player isn’t actually swimming in water.

Okay, have you set the animation priority to Action2 as CreatorBenn suggested?

It works, thanks for the help. I’m having another problem now though and it seems to be because of the script. The script sometimes detects that your aren’t in the water even though your are so it switches back to the running animation. Is there anyway to make it smoother. This has been shown at the bottom where it prints that it has detected my player being in the water but sometimes it isn’t. Here is a clip:

Yes, let the validation for being above water, higher up, when you have just entered water meaning:

local EnterSwimmingMode_Y = -1
local LeaveSwimmingMode_Y = -0.25

That gives a gap of -0.75, where the player is not entering or leaving swimming mode, but is keeping the state they’re in.

I think I understand how this works, but i’m a little lost on how to put this into code. Thanks for the help though.

You should have somewhere in your script, where you tick swimming off/on before anything else. Then you just do the following

local Swimming = fasle -- Let this be outside your function

-- Next is inside
if Character.PrimaryPart.Position.Y < -1 and not Swimming then
Swimming = true
elseif Character.PrimaryPart.Position.Y > -0.25 and Swimming then
Swimming = false
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.