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

Animation won't Play?

Asked by
KenzaXI 166
8 years ago

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

Log in to vote
0
Answered by 8 years ago
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)
0
Won't Work KenzaXI 166 — 8y
Ad

Answer this question