Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I animate all body parts while using a tool?

I'm trying to animate a sword and it keeps playing all the animations EXCEPT the right hand, which is all I want to animate, I've only tried animations by adding keybinds to a button then adding the script:

function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.E then
		local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Animation) -- I normally put my animation under the script
	end
end
 
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

I tried putting some part of the code into the sword but it didn't work. Can someone help?

1 answer

This might help.

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then
        local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Animation)
	animation:Play()
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

Another thing too, is make sure your animation's priority is high, and you have only selected specific bodyparts to animate in the animation editor.

Failure to do so could result in animations not properly playing, or the player being completely static except for the arm.

I hope I helped. If you need anymore assistance, feel free to contact me directly through Discord or Roblox. :)

fireking100489 Founder of Blazing Games

This discussion is preserved as it was. New answers, comments, and votes are closed.