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

How do people make animations play with the "Keydown" event?

Can somebody help me, I don't know how to use the keydown event, and I'd like someone to explain to me how to do it and make animations, and If you're nice enough you'll also tell me about velocity as in body objects.

1 answer

✓ Accepted answer

KeyDown and Animation

User = game.Players.Estomac
UserMouse = User:GetMouse()

Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/Asset?ID=0"  -- Animation's id
Animation.Name = "Name"
animTrack = User.Character.Humanoid:LoadAnimation(Animation)

UserMouse.KeyDown:connect(function(key) -- keydown function
	if key == "p" then 
	animTrack:Play()
	end
end)

2 comments

1

How would you make that accessable for everyone, instead of 1 person?

1

LocalPlayer

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