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

How to animate a player using a key input and the ROBLOX Animator Plugin?

Asked by 8 years ago

I've tried a variety of scripts trying to make it so that I can take an animation I made with the Roblox animator plugin, and making it so that I can animate the player when the f key is pressed and when it is pressed it will animate the stab while the knife is in hand. I got the weld to work. I just don't know how to get the animations to work. Help please?

0
I'm an animation master I'll help :D Hero_ic 502 — 8y

2 answers

Log in to vote
2
Answered by
Hero_ic 502 Moderation Voter
8 years ago

Okay so here is how we do it. We need to get the userinputservice inputbegan function and get the animations first we create a local script in the startergui

--and get the player and character and humanoid
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.Character:Added()
local humanoid = character:WaitForChild("Humanoid")
--Next we make our animation
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://YOURIDNUMBERSHERE"
--Now we can make a function to play animations!
function playAnimation(Anim)
    local track = humanoid:LoadAnimation(Anim)
    track:Play()
end
--Now we play it when using the userinputservice
game:GetService("UserInputService").InputBegan:connect(function(input ,proc)
    if not proc then
        if input.KeyCode == Enum.KeyCode.F then --get the F key using Enum
            playAnimation(anim) --plays our animation using our function :)
        end
    end
end)

That is it! If I made any mistake please let me know in the comments and thanks for asking!~ KIHeros~

0
Thank you!!! iDev_Percy 45 — 8y
0
Your welcome!~~ Hero_ic 502 — 8y
0
Doesn't Work; need help ! AKT_Arthas 2 — 6y
Ad
Log in to vote
0
Answered by 5 years ago

Welp you did make this 2 years ago but I am having a problem with this script. Any animation that is played appera as 'invalid' I tried to use debugs and it got to my answer. It migth be possible it is not 'filtering enabled' but I have chances that it's not. Maybe, you can reply soon to maybe fix the issue.

Yours and truely -TruelyUnfair

Answer this question