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
COMMUNITY QUESTION
how to u make a keypress event play a animation?
1 answer
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)
2 comments
1
keydown is deprecated. UIS is better
0
Yeah, it sends wrong messages.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
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