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!
I'll fix your errors.. You put
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)
Try it THIS way
wait(2) -- Wait local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local anim = Player.Character.Humanoid:LoadAnimation(game.StarterPack.LocalScript.Animation) Mouse.KeyDown:connect(function(Key) if Key == "q" then anim:Play() end end)
OR this way..
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 Instance.new("Animation") Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213" wait(1) Player.Character.Humanoid:LoadAnimation(Animation) animTrack:Play() end end)
I didn't test these, I believe I made a mistake. Let me know if I did and I'll fix it for you. I'm a newbie scripter btw.