Existence_YT

[RobloxStudioProjects] CustomHotbar - HB_Client

Mar 18th, 2020
7,563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local UI = script.Parent
  2. local MainFrame = UI.MainFrame
  3. local StrNum = {["One"] = "1", ["Two"] = "2", ["Three"] = "3", ["Four"] = "4", ["Five"] = "5", ["Six"] = "6", ["Seven"] = "7", ["Eight"] = "8", ["Nine"] = "9"}
  4.  
  5. local SelectedSlot = 0
  6. function hotbarKey(Slot)
  7.     for i, v in pairs(MainFrame:GetChildren()) do if v.ClassName == "ImageButton" then v.SlotName.TextColor3 = Color3.fromRGB(255,255,255) v.bg.ImageColor3 = Color3.fromRGB(46, 46, 46) end end
  8.     SelectedSlot = tonumber(Slot.SlotName.Text)
  9.     Slot.SlotName.TextColor3 = Color3.fromRGB(0, 170, 255)
  10.     Slot.bg.ImageColor3 = Color3.fromRGB(255, 255, 255)
  11. end
  12. function ConvKeyCode(KeyCode)
  13.     for i, v in pairs(StrNum) do
  14.         if KeyCode == Enum.KeyCode[i] then
  15.             hotbarKey(MainFrame["Slot"..v])
  16.         end
  17.     end
  18. end
  19. game:GetService("UserInputService").InputBegan:Connect(function(key)
  20.     ConvKeyCode(key.KeyCode)
  21. end)
Add Comment
Please, Sign In to add comment