Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Animation won't Play?

As mentioned on my title, I've read through all the pages in wiki on Animations so I believe there should be no errors but yet it doesn't work, I even watched about 5 video tutorials from highly recommended Roblox channels and yet I still can't identify any errors especially since there's nothing in the output. Here's the script:

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        local Animation = Instance.new("Animation")
        Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213"
        local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
        animTrack:Play()
    end
end)

Thanks for the Help!

1 answer

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        local Animation = Instance.new("Animation",Player.Character)--Forgot to give it a parent.
        Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213"
       Animation.Name = "Ani"
	 local animTrack = Player.Character.Humanoid:LoadAnimation(Player.Character:WaitForChild("Ani"))
        animTrack:Play()
    end
end)

1 comment

0

Won't Work

This discussion is preserved as it was. New answers, comments, and votes are closed.