Swimming animation not working

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a swimming animation.

  2. What is the issue? Include screenshots / videos if possible!
    The animation doesn’t play and instead playing a jumping animation.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked for hours and cannot find a solution that works. (The animation is on the group!)

wait(5)

local plr = game.Players.LocalPlayer
local char = plr.Character
local swim = script.Parent.Animations.R15:FindFirstChild("Swim")
local swimidle = script.Parent.Animations.R15:FindFirstChild("SwimIdle")
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
	local hum = char.Humanoid
	local animator = hum.Animator
	if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.Space or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.D and hum:GetStateEnabled(Enum.HumanoidStateType.Swimming) then
		print("swimming")
		local a1 = hum:LoadAnimation(swim)
		a1:Play()
	else
		print("idle")
		local a2 = hum:LoadAnimation(swimidle)
		a2:Play()
	end
end)

image
(every other animation works fine, just the swimming.)

I’m not very experienced in animation but I know some things that could help you in finding your answer.

First of all, you need to make sure that your animation is not just getting overwritten by another animation. Animations have this animation priority thing and you need to make sure that the current animation is the highest priority.

I hope my answer helps you in finding your solution! Try looking at animation priorities.

1 Like

Thanks a lot! I’ll try this now.

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