Advertisement
JuiceCanX

Hidden Devs Application Code

Apr 11th, 2023 (edited)
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.02 KB | None | 0 0
  1. local function equip(weapon)
  2.     if char:FindFirstChild(weapon.Name) then
  3.         if currentgun ~= weapon then
  4.             locke = true
  5.             st = require(weapon.Data.Modules.settings)
  6.             currentgun = weapon
  7.             print("Loading "..currentgun.Name)
  8.             frate = st.rate
  9.             auto = st.auto
  10.             switchdelay = true
  11.             delay(0.25,function()
  12.                 switchdelay = false
  13.             end)
  14.             if not idle or not fire or not reload then
  15.                 idle = char.Humanoid.Animator:LoadAnimation(weapon.Data.Animations.Idle)
  16.                 fire = char.Humanoid.Animator:LoadAnimation(weapon.Data.Animations.Fire)
  17.                 reload = char.Humanoid.Animator:LoadAnimation(weapon.Data.Animations.Reload)
  18.                 lowered = char.Humanoid.Animator:LoadAnimation(weapon.Data.Animations.Lowered)
  19.                 if not st.shotgunreload then
  20.                     reload.Stopped:Connect(function()
  21.                         if currentgun then
  22.                             if currentgun.Data.Ammo.Reserve.Value > 0 then
  23.                                 if currentgun.Data.Ammo.Mag.Value < st.mag then
  24.                                     local ammotakefromleftover = st.mag - currentgun.Data.Ammo.Mag.Value
  25.                                     if currentgun.Data.Ammo.Reserve.Value > ammotakefromleftover then
  26.                                         currentgun.Data.Ammo.Mag.Value = st.mag
  27.                                         currentgun.Data.Ammo.Reserve.Value = currentgun.Data.Ammo.Reserve.Value - ammotakefromleftover
  28.                                     else
  29.                                         currentgun.Data.Ammo.Mag.Value = currentgun.Data.Ammo.Reserve.Value
  30.                                         currentgun.Data.Ammo.Reserve.Value = 0
  31.                                     end
  32.                                     uiupdate()
  33.                                 end
  34.                             end
  35.                             rld=false
  36.                         end
  37.                     end)
  38.                 end
  39.             end
  40.             if not weapon.Data.Ammo:FindFirstChild("Done") then
  41.                 local th = Instance.new("Folder",weapon.Data.Ammo); th.Name = "Done"
  42.                 currentgun.Data.Ammo.Mag.Value = st.mag
  43.                 currentgun.Data.Ammo.Reserve.Value = st.rsrv
  44.             end
  45.             uiupdate()
  46.             print(currentgun.Name.." was successfully equipped")
  47.             if currentgun.Data:FindFirstChild("silenced") then
  48.                 currentgun.Handle.Suppressor.Highlight.Adornee = nil
  49.                 delay(0.1,function()
  50.                     currentgun.Handle.Suppressor.Highlight.Adornee = currentgun.Handle.Suppressor
  51.                 end)
  52.             end
  53.         end
  54.     end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement