Well. Im trying to make a button trigger a gui animation. So I need to know this.
This would actually fall into using the Mouse
and PlayerMouse
properties instead of UserInputService.
Here is some sample code that prints the key pressed to the output: (note: it must be placed inside a LocalScript, which in turn is placed inside of the StarterGui)
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() mouse.KeyDown:connect(function(key) print(key) end) --Written off the top of my head, may or may not work.