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

How to solve keydown animation?

Asked by
Akozta 40
7 years ago
Edited 7 years ago
Player = script.Parent.Parent 
mouse = Player:GetMouse()

local Animation = { 
    Animation =     {   
                { id = "http://www.roblox.com/asset/?id=320954787"}}}

function onKeyDown(key)
   key = key:lower()
   if key == "q" then 
  Player.Character.Humanoid:LoadAnimation(Animation)

   end
end

mouse.KeyDown:connect (onKeyDown)

Output: Script 'Players.Player1.Backpack.LocalScript', Line 11

1
Are you creating the animation anywhere? MrLonely1221 701 — 7y
1
It also appears that you are not embedding the array properly MrLonely1221 701 — 7y
1
You are passing a table to the load animation function? User#5423 17 — 7y
1
instead of Animation use Animation[1][1] as you're using a multi-dimentional-array RubenKan 3615 — 7y
0
Thanks guys! Akozta 40 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

u didnt make the animation play and u make a array instead of a animation id

local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local animation = Instance.new('Animation')
animation.AnimationId = 'rbxassetId://(id)'

function OnKeyDown(key)
 key = key:lower()
if key == 'q' then
trackanim = Player.Character.Humanoid:LoadAnimation(animation)
trackanim:Play()

end
end

mouse.KeyDown:connect(OnKeyDown)
0
Thank you. Akozta 40 — 7y
Ad

Answer this question