Advertisement
ProIsEpix_Dev

SetupClient

Jan 11th, 2025
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.02 KB | None | 0 0
  1. --// Variables //--
  2. local PhysicsService        = game:GetService("PhysicsService")
  3. local ReplicatedStorage     = game:GetService("ReplicatedStorage")
  4. local Player                = game:GetService("Players").LocalPlayer
  5. local UIS                   = game:GetService("UserInputService")
  6. local TS                    = game:GetService("TweenService")
  7.  
  8. local Template              = ReplicatedStorage.Storage.SlotTemplate
  9. local ClassModule           = ReplicatedStorage.Modules.DataList
  10. local Modules               = ReplicatedStorage.Modules
  11. local Red                   = require(Modules.Red)
  12.  
  13. local CharacterNet          = Red.Client("CharacterNet")
  14. local CooldownNet           = Red.Client("Cooldown")
  15.  
  16. local AcceptableNames       = {"One", "Two", "Three", "Four"}
  17. local Conversion            = {["One"] = "1", ["Two"] = "2", ["Three"] = "3", ["Four"] = "4"}
  18.  
  19. local keybindPress = function(key)
  20.     CharacterNet:Fire("UseMove", {
  21.         key;
  22.     })
  23. end
  24.  
  25. --[[
  26. for index, value in  do
  27.     if index == Player:FindFirstChild("Class").Value then
  28.         task.wait(1)
  29.         local currentClassModule = value
  30.         for i, slot in currentClassModule.Movesets do
  31.             if table.find(AcceptableNames, i) then
  32.                 local newSlot = Template:Clone()
  33.                 newSlot.LayoutOrder = tonumber(Conversion[i])
  34.                 newSlot.Parent = script.Parent.Hotbar.ContainerSlots
  35.                 newSlot.HotbarHitbox.SlotName.Text = currentClassModule.Movesets[i].name
  36.                 newSlot.HotbarHitbox.SlotNumber.Text = Conversion[i]
  37.                 newSlot.HotbarHitbox.MouseButton1Down:Connect(function()
  38.                     keybindPress(i)
  39.                 end)
  40.             end
  41.         end
  42.     end
  43. end
  44. ]]
  45.  
  46. for index, key in AcceptableNames do
  47.     UIS.InputBegan:Connect(function(input, gp)
  48.         if gp then return end
  49.         if input.KeyCode == Enum.KeyCode[key] then
  50.             keybindPress(key)
  51.         end
  52.     end)
  53. end
  54. -- Block?
  55. UIS.InputBegan:Connect(function(input, gp)
  56.     if gp then return end
  57.     if input.KeyCode == Enum.KeyCode.F then
  58.         CharacterNet:Fire("BlockStart")
  59.     end
  60. end)
  61.  
  62. UIS.InputEnded:Connect(function(input, gp)
  63.     if gp then return end
  64.     if input.KeyCode == Enum.KeyCode.F then
  65.         CharacterNet:Fire("BlockEnd")
  66.     end
  67. end)
  68.  
  69. CharacterNet:On("CharacterSet", function(data)
  70.     local currentClassModule = require(ClassModule.CharacterClass)[data]
  71.     for i, frame in script.Parent.Hotbar.ContainerSlots:GetChildren() do
  72.         if frame:IsA("Frame") then
  73.             frame:Destroy()
  74.         end
  75.     end
  76.     for i, slot in currentClassModule.Movesets do
  77.         if table.find(AcceptableNames, i) then
  78.             local newSlot = Template:Clone()
  79.             newSlot.Name = i
  80.             newSlot.LayoutOrder = tonumber(Conversion[i])
  81.             newSlot.Parent = script.Parent.Hotbar.ContainerSlots
  82.             newSlot.HotbarHitbox.SlotName.Text = currentClassModule.Movesets[i].name
  83.             newSlot.HotbarHitbox.SlotNumber.Text = Conversion[i]
  84.             newSlot.HotbarHitbox.MouseButton1Down:Connect(function()
  85.                 keybindPress(i)
  86.             end)
  87.         end
  88.     end
  89. end)
  90.  
  91. CooldownNet:On("Cooldown", function(data)
  92.     local slot = script.Parent.Hotbar.ContainerSlots:FindFirstChild(data[1])
  93.     local UIGradient = slot.HotbarHitbox.Cooldown.UIGradient
  94.    
  95.     UIGradient.Offset = Vector2.new(0, 0)
  96.     print(data[2])
  97.     TS:Create(UIGradient, TweenInfo.new(data[2] + 1.5), {Offset = Vector2.new(0, 1)}):Play()
  98. end)
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement