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

how to u make a keypress event play a animation? [closed]

Asked by
JollyDumb -21
7 years ago

This question already has an answer here:

How to play an Animation when you press a key?

i made an animation wheere a player does something how do i make it if key 'r' is presset then the character does that animation

0
local player = game.Players.LocalPlayer local Mouse = player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "r" then s = player.Character.Humanoid:LoadAnimation(LOCATION OF ANIMATION HERE) s:Play() end) --Helped by xXSolarSolisticXx xXiNotoriousXx 31 — 7y

Marked as Duplicate by Goulstem

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by
Nikkulaos 229 Moderation Voter
7 years ago
Edited 7 years ago
local player = game.Players.LocalPlayer
local m = player:GetMouse()

m.KeyDown:Connect(function(key)
if key == "q" then --Edit this
local anim=Instance.new("Animation",workspace)
anim.AnimationId = "http://www.roblox.com/Asset?ID=0000" -- Put id here
local animTrack = player.Character.Humanoid:LoadAnimation(anim)
animTrack:Play()
end
end)
1
keydown is deprecated. UIS is better oSyM8V3N 429 — 7y
0
Yeah, it sends wrong messages. hiimgoodpack 2009 — 7y
Ad