Advertisement
TaylorsRus

KeybindsUtil

Mar 9th, 2023
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.11 KB | None | 0 0
  1. local KeybindsUtil = {}
  2.  
  3. KeybindsUtil.Keybinds = {
  4.     Idle = {
  5.         [Enum.KeyCode.R] = "StateChange",
  6.         [Enum.KeyCode.W] = "Run",
  7.         [Enum.KeyCode.Equals] = "EventMenu",
  8.         [Enum.KeyCode.Q] = "Dash",
  9.         [Enum.KeyCode.G] = "Ragdoll",
  10.         [Enum.KeyCode.K] = "Knockout", 
  11.         [Enum.KeyCode.One] = "EquipSword",
  12.     },
  13.     Combat = {
  14.         [Enum.KeyCode.R] = "StateChange",  
  15.         [Enum.KeyCode.W] = "ChangeStance",
  16.         [Enum.KeyCode.A] = "ChangeStance",
  17.         [Enum.KeyCode.S] = "ChangeStance",
  18.         [Enum.KeyCode.D] = "ChangeStance",
  19.         [Enum.KeyCode.LeftShift] = "Slow",
  20.         [Enum.UserInputType.MouseButton1] = "Combat",
  21.         [Enum.UserInputType.MouseButton2] = "Combat"
  22.     },
  23.     Skills = {
  24.         [Enum.KeyCode.Z] = "ThunderClap"
  25.     }
  26. }
  27.  
  28. function KeybindsUtil:GetAvailableBinds(Player)
  29.     local State = self.DataStore:GetData(Player, "State")
  30.    
  31.     local UsableBinds = {}
  32.    
  33.     for AssociatedBinds, BindsTable in pairs(self.Keybinds) do
  34.         local CorrectBinds = AssociatedBinds == State or AssociatedBinds == "Skills"       
  35.         if not CorrectBinds then continue end
  36.        
  37.         UsableBinds[AssociatedBinds] = BindsTable
  38.     end
  39.    
  40.     return UsableBinds
  41. end
  42.  
  43. return KeybindsUtil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement