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

How can I get the UserInputService to grab the key "e"?

So I can make it trigger the animation in my gui so that people can press "e" and my gui animation will occur I have no idea how to do this and I need help so please help.

2 answers

✓ Accepted answer

UserInputService is not required to create a KeyDown function.

I suggest reading the Wiki for help on KeyDown and help on Animations.

Click on the "Playing Animations in Player Character", section 2.1, in the table of contents of the Wiki I linked you for the animations.

How to make a function for the key F from a LocalScript:

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()

Mouse.KeyDown:connect(function(key))
if key == "f" then
--code
end
end)

4 comments

0

Well I am mostly trying to make the key down function only 1 specific key. And im not trying to do body animations im trying to do it with gui animations.

0

Edited my answer.

0

thanks!!!

0

It worked ty

local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) print(key) end)

1 comment

0

but how do I make it a specific key??? Thats what I really want to know.

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