how do you do you make something [function] when a key is pressed? like
when key "f" animation plays. or etc
how do you do you make something [function] when a key is pressed? like
when key "f" animation plays. or etc
This should work :
--//
local UIS = game:GetService("UserInputService")
local p = game.Players.LocalPlayer
--//
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=idhere"
local animTrack = Humanoid:LoadAnimation(animation)
UIS.InputBegan:Connect(function(Input, gameProcessedEvent)
local KeyCode = Input
if not gameProcessedEvent then
if KeyCode == Enum.KeyCode.F then
animTrack:Play()
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
http://wiki.roblox.com/index.php?title=API:Class/UserInputService
thx but what is animtrack?