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

How to solve keydown animation?

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

5 comments

1

Are you creating the animation anywhere?

1

It also appears that you are not embedding the array properly

1

You are passing a table to the load animation function?

1

instead of Animation use Animation[1][1] as you're using a multi-dimentional-array

0

Thanks guys!

1 answer

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)

1 comment

0

Thank you.

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