Vzurxy

ic3's input api

Dec 19th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. local input = {}
  2. local uis = game:service'UserInputService'
  3.  
  4. input.mouse = game:GetService'Players'.LocalPlayer:GetMouse();
  5.  
  6. input.down = setmetatable({}, {
  7.     __index = function(i, v)
  8.         local isDown = false;
  9.         v = v:lower();
  10.         for _, key in pairs(Enum.UserInputType:GetEnumItems()) do
  11.             if (key.Name:lower() == v and uis:IsMouseButtonPressed(key.Name)) then
  12.                 isDown = true;
  13.             end
  14.         end
  15.         for _, key in pairs(Enum.KeyCode:GetEnumItems()) do
  16.             if (key.Name:lower() == v and uis:IsKeyDown(key.Name)) then
  17.                 isDown = true;
  18.             end
  19.         end
  20.         return isDown
  21.     end
  22. })
  23.  
  24. getgenv().input = input;
Add Comment
Please, Sign In to add comment