Whenever I try to test the code I made (do an animation while summoning a fireball), the output says that " LoadAnimation requires the Humanoid object (Player1.Humanoid) to be a descendant of the game object" Any ideas why and house to fix it. and I am sorry that I dont understand very well... I just started scripting 4 days ago. Here is my code..
animation.AnimationId = "http://www.roblox.com/asset/?id=853522647" -- ex http.robloxblahblah local animTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(animation) game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.E then animTrack:Play() end end)
If you started scripting 4 days ago, I better not help because you should learn the basics before advancing. I'm not going to explain much but first here are some steps;
- Create an object called Animation and place it in
**ServerStorage**
OrReplicatedStorage
- Make sure the animation has the correct Id
If you followed those steps then good, I'm not going to help you make your script though, you will have to learn where to place certain things for your own good.
First, make a variable for the animation
so do this;
local animation = game.ReplicatedStorage:WaitForChild('Animation') --Change to serverStorage or change animation name
Now you load the animation into the humanoid;
local humanoid = game.Players.LocalPlayer:WaitForChild('Character').Humanoid -- make sure you have the humanoid first
Now lastly UserInputService;
local humanoid = game.Players.LocalPlayer:WaitForChild('Character').Humanoid -- make sure you have the humanoid first local animation = game.ReplicatedStorage:WaitForChild('Animation') --Change to serverStorage or change animation name game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.E then local animTrack = Humanoid:LoadAnimation(animation) animTrack:Play() end end)
For more info; http://wiki.roblox.com/index.php?title=Animations
If this helped then please accept answer. And to be honest, it's rare for people to help with these question.
Good luck.