So i'm trying to change the tools with two keys, maybe Q and E but i don't know how to do it. I know it has something to do with the keyboard input and local scripts. I would appreciate any help.
This is a little script I made that should work. It works on a ServerScript
and LocalScript
.
local uis = game:GetService("UserInputService") -- Get the UserInputService. uis.InputBegan:connect(function(inputObject) -- Function fires when any input from your device is recieved, where inputObject is an Instance with a Child containing information about the key, button or anything else. if inputObject.KeyCode == Enum.KeyCode.E then -- If statement that checks if the KeyCode is E print("E was pressed!") -- Print success. end end)
Read more here: http://wiki.roblox.com/index.php?title=API:Class/UserInputService/InputBegan