Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question