I know how to make an animation, but I dont know how to put it in my game :(. The normal roblox animations are so BORING, but unfortunately I cant make my own because I cant script them, so any help would be appreciated, thank you.
How to script Animations?
1 answer
Solution:
It's very easy to script animations however, if I were you I'd learn the basics of scripting first. However, I am going to assume that you already know the basics. So, to script an animation you would have to load it into the Humanoid. You add the object Animation into the game. Then you change the numbers at the end of the Id of the Animation object(in the property of the object) to the numbers at the end of the url of your animation that you exported to Roblox. So, once you've added the Animation you're set object-wise. Now, I am not sure what type of script you're going to use however, I will assume it's a Local Script because it's easier to identify the player. If you're doing that then you would script something like this. If you want the Animation to play on the Character when the Player press "Q" on his keyboard you would need to use UserInputService. I am going to assume the Animation is placed under the Local Script. Here this is how you would script it:
local player = game.Players.LocalPlayer -- This is the player
local anim = script:WaitForChild("Animation") -- This waits for the animation
local uis = game:GetService("UserInputService") -- This gets the service called "UserInputService"
function animate(inputObject, gp) -- This is a function called animate. The perimeters allow me to access the key you press down and to check if the key was pressed for the correct reason. It checks if it was while you were chatting or if you meant for the key to be pressed. So that the function does not activate while you're typing in chat..
if inputObject.KeyCode = Enum.InputObject.KeyCode.Q and not gp then -- If statement to set the KeyCode to Q. So now if you click 'Q' this function will run. As long as you're not in chat.
local char = player.Character -- Variable for the character. Needs to be identified in-the-function if you want to identify the character that the player is in-control of.
local hum = char:WaitForChild("Humanoid") -- Variable for humanoid
local animtrack = hum:LoadAnimation(anim) -- Animation track. This loads the animation to the humanoid.
animtrack:Play() -- This is how you play it. Using the :Play() function just like what you do with Sounds.
end
end
uis.InputBegan:connect(animate)
If your animation doesn't work after the above code then try with another animation that someone else made that is maybe popular. Because you probably did not make your animation correctly.
Link to show you how to correctly make the animation
Link to show you how to script the animation with a debounce as well.
I hope I helped and if you are encountering any other issues, please feel free to post a comment below ^_^!
~~ KingLoneCat
3 comments
It didnt work for me even though I did everything right (I think) I made my animation, then I put the url for the animation into the AnimationId, then I made a LocalScript and put the animation inside of there, then copied to script from here to roblox studio, Then I played the game and pressed q, and nothing happened.
Don't put the whole url in the animationid.... Remove the numbers at the end of the AnimationId and take the numbers in the url that are at the very end....
Check out the videos that I linked in my answer... They will teach you how to as well.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
its all in this wiki http://wiki.roblox.com/index.php?title=Animations
I was looking at that a while ago and I couldn't understand it. Thats why I came here .-.