Punch animation doesn't work as expected

The expectation is that the animation runs correctly at the same time as the character moves, but it is happening that when I do this, the animation leaves the character’s legs immobile. Note: I set the AnimationPriority to Action 4 but it still doesn’t work, and what’s more, it completely bugs the character, leaving him in weird positions

If necessary, I can send the scripts

7 Likes

Wrong category, it should be in scripting support.

4 Likes

I think I know what’s causing it.

Usually, when you make an animation, every bodypart’s position is set to default,

Can you open your animation and confirm if there’s keyframes at the very start? If there are, remove them all except for the arm keyframes. Let me know the result (sending an image of the animator interface with your rig open would be helpful)

Have you stopped the animation when its completed? (it would be helpful that you send animation script)

:smile:

3 Likes

Man I think you’re right, I have keyframes at the start, like default position, Ill delete and verify if that work

2 Likes

The image (right punch, the left punch animation is the same but inverted):

LocalScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("PunchEvent"):WaitForChild("RemoteEvent")

script.Parent.Activated:Connect(function()
	print("Hello?")
	event:FireServer()
end)

Script:

local chosen = true

game:GetService("ReplicatedStorage").PunchEvent.RemoteEvent.OnServerEvent:Connect(function(player)
	local character = player.Character
	local rightPunch = script:WaitForChild("RightPunch", 1)
	local leftPunch = script:WaitForChild("LeftPunch", 1)
	local humanoid = character:FindFirstChildOfClass("Humanoid")
	
	local animator = Instance.new("Animator", humanoid)
	animator.Parent = humanoid
	
	local rightLoaded = animator:LoadAnimation(rightPunch)
	local leftLoaded = animator:LoadAnimation(leftPunch)
	
	if chosen then
		chosen = false
		print("Are you working?")
		rightLoaded:Play()
		rightLoaded.Stopped:Connect(function()
			wait(0.4)
		end)
	else
		leftLoaded:Play()
		print("Are you working? ddd")
		chosen = true
		leftLoaded.Stopped:Connect(function()
			wait(0.4)
		end)
	end
	
end)

3 Likes

That didnt work, Idk if i need to recopy the animationid and paste, because its the same

3 Likes

A re-copy is not necessary

You might need to click on the three dots in the animation editor, then click “Publish to Roblox”, then find a button that says “Replace” in the bottom left, select the punch animation and then confirm.

:smile:

3 Likes

I did that, this animation is different from what i did before, but it still doesnt work

2 Likes

This is because your animation doesnt have walking - when walking, it runs a separate animation. What you are trying to do is combine 2 animations in one, the walking for the legs, and the punching for the arms.

1 Like

can i do that (combine) or do i need to make animation on legs too?

1 Like

What do you mean?

You can try to animate the punching on ONLY the upper part of the body - that is, the arms, the torso, and the head. That will leave the legs with no animation. Then you can create custom animations for the legs, which are for walking/running, and trigger those from a script.

Cheers

Take a look at this too