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?
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~
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