Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- repeat
- wait()
- until game.Players.LocalPlayer
- local nocol = {}
- nocol.events = {}
- nocol.cache = {}
- nocol.classes = {}
- nocol.network = {}
- nocol.springs = {}
- function waitfor2(parent, child)
- repeat
- wait()
- until parent:FindFirstChild(child)
- return parent[child]
- end
- waitfor = workspace.WaitForChild
- nocol.cache = {
- max = math.max,
- min = math.min,
- abs = math.abs,
- sin = math.sin,
- cos = math.cos,
- tan = math.tan,
- rnd = math.random,
- sed = math.randomseed,
- deg = math.deg,
- pie = math.pi,
- rad = math.rad,
- acos = math.acos,
- asin = math.asin,
- clmp = math.clamp,
- sign = math.sign,
- vc2 = Vector2.new,
- _vc2 = Vector2.new(),
- vc3 = Vector3.new,
- _vc3 = Vector3.new(),
- ud2 = UDim2.new,
- _ud2 = UDim2.new(),
- ud1 = UDim.new,
- _ud1 = UDim.new(),
- cfr = CFrame.new,
- _cfr = CFrame.new(),
- ang = CFrame.Angles,
- _ang = CFrame.Angles(0, 0, 0),
- ray = Ray.new,
- ins = Instance.new,
- ser = game.GetService,
- gap = 30,
- findchild = workspace.FindFirstChild,
- player = game.Players.LocalPlayer,
- pgui = game.Players.LocalPlayer.PlayerGui,
- camera = workspace.CurrentCamera,
- waitfor = workspace.WaitForChild,
- backpack = waitfor2(game.Players.LocalPlayer, "Backpack"),
- mouse = game.Players.LocalPlayer:GetMouse(),
- lerp = function(a, b, t)
- return (1 - t) * a + t * b
- end,
- cspace = 0,
- run = game:GetService("RunService"),
- input = game:GetService("UserInputService")
- }
- ang = nocol.cache.ang
- rad = nocol.cache.rad
- cfr = nocol.cache.cfr
- v3 = nocol.cache.vc3
- min = nocol.cache.min
- max = nocol.cache.max
- rdef = cfr(1, 0.5, 0, -4.37113883E-8, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883E-8)
- ldef = cfr(-1, 0.5, 0, -4.37113883E-8, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883E-8)
- nocol.cache.func = waitfor(game.ReplicatedStorage, "NoCol_Function")
- nocol.cache.event = waitfor(game.ReplicatedStorage, "NoCol_Event")
- do
- local a, b = 69, 420
- function nocol.network.call(call, ...)
- nocol.cache.func:InvokeServer(call, [[
- }]], ",{METATABLE DOESNT EXIST,", [[
- ]], ...)
- end
- function nocol.network.receive(call, ...)
- end
- end
- nocol.classes.bullet = require(script.MODULES.BULLETS)
- nocol.classes.animate = require(script.MODULES.ANIMATE)
- nocol.classes.effect = require(script.MODULES.EFFECTS)
- nocol.classes.misc = require(script.MODULES.MISC)
- nocol.springs.fire = nocol.classes.misc.physics.spring.new(v3())
- nocol.springs.fire.s = 70
- nocol.springs.fire.d = 1
- nocol.springs.cam = nocol.classes.misc.physics.spring.new(v3())
- nocol.springs.cam.s = 35
- nocol.springs.cam.d = 1
- nocol.classes.tool = {
- container = {},
- events = {}
- }
- function nocol.classes.tool:__index(index)
- return nocol.classes.tool[index]
- end
- function nocol.classes.tool.new(tool)
- local data = nocol.cache.findchild(tool, "CONFIG")
- if data then
- data = require(data)
- else
- error("INVALID WEAPON")
- return
- end
- local wep = setmetatable({
- bin = tool,
- rpm = 60 / (data.rpm or 200),
- dmg = data.dmg or 20,
- spread = data.spread or 0.1,
- recoil = data.recoil or v3(1, 1, 1),
- audio = data.audio,
- volume = data.volume or 0.2,
- audrep = data.audio_rep,
- bullet = data.bullet,
- amount = data.bulletamount or 1,
- firemode = data.firemode,
- teamkill = data.teamkill,
- onfire = data.onfire,
- onhit = data.onhit,
- onrel = data.onrel,
- animations = {},
- __tick = tick() + 60 / (data.rpm or 200),
- __anims = data.animations,
- __gc = function(garbage)
- print(garbage)
- end,
- __state = {
- equipped = false,
- ammo = {
- data.ammo,
- data.ammo
- },
- state = "idle"
- }
- }, nocol.classes.tool)
- nocol.classes.tool.container[tool] = wep
- nocol.network.call("ownership", tool)
- tool.Equipped:connect(function()
- wep.equipped(wep)
- end)
- tool.Unequipped:connect(function()
- wep.unequipped(wep)
- end)
- tool.AncestryChanged:connect(function(c, p)
- if c == tool and p == nil then
- wep:unbind()
- end
- end)
- return tool, wep
- end
- function nocol.classes.tool:unbind()
- if self.bin then
- self.bin:Destroy()
- end
- nocol.classes.tool.container[self] = nil
- for animation_id = 1, #self.animations do
- if self.animations[animation_id] then
- self.animations[animation_id]:Stop(0.2)
- self.animations[animation_id] = nil
- end
- end
- if collectgarbage("count") % 2 ~= 0 then
- print("(possible) lag")
- end
- print("unbound")
- end
- function nocol.classes.tool:animate(index, delta, fade, speed, keyframe)
- fade = fade or 0
- speed = speed or 1
- if not nocol.cache.findchild(self.bin.NoCol, index) then
- end
- if not self.animations[index] then
- local anim = Instance.new("Animation")
- anim.AnimationId = self.__anims[index]
- local animation = nocol.cache.player.Character.Humanoid:LoadAnimation(anim)
- local kf
- kf = animation.KeyframeReached:connect(function(kf)
- if string.sub(kf, 1, 3) == "sf-" then
- local id = string.sub(kf, 4)
- local s = Instance.new("Sound", self.bin.Handle)
- s.SoundId = "rbxassetid://" .. id
- s:Play()
- game.Debris:AddItem(s, 1)
- end
- end)
- anim:Destroy()
- self.animations[index] = animation
- end
- if delta then
- self.animations[index]:Play(fade, 1, speed)
- return self.animations[index]
- else
- self.animations[index]:Stop(fade)
- end
- end
- function nocol.classes.tool:set(tab, index, value)
- tab[index] = value
- if nocol.cache.gui then
- nocol.cache.gui.Ammo.Text = self.__state.ammo[1] .. "/" .. self.__state.ammo[2]
- end
- end
- function nocol.classes.tool:equipped()
- if not self.__state.equipped then
- self.__state.equipped = true
- do
- local idle = self:animate("idle", true, 0.2)
- nocol.classes.tool.events[#nocol.classes.tool.events + 1] = game.Players.PlayerAdded:connect(function()
- local humanoid = nocol.cache.character:FindFirstChild("Humanoid")
- if humanoid then
- local animations = humanoid:GetPlayingAnimationTracks()
- for _, track in next, animations, nil do
- local originalPosition = track.TimePosition
- track:Stop(0)
- track.TimePosition = 0
- track:Play(0)
- track.TimePosition = originalPosition
- end
- end
- end)
- nocol.cache.input.MouseIconEnabled = false
- nocol.cache.gui = script.ASSETS.HuD:clone()
- nocol.cache.gui.Enabled = true
- nocol.cache.gui.Parent = nocol.cache.pgui
- nocol.cache.gui.Ammo.Text = self.__state.ammo[1] .. "/" .. self.__state.ammo[2]
- nocol.cache.character.Torso:WaitForChild("Right Shoulder")
- nocol.cache.character.Torso:WaitForChild("Left Shoulder")
- nocol.cache.character.Torso:WaitForChild("Grip")
- nocol.cache.rig = {
- nocol.cache.character.Torso["Right Shoulder"],
- nocol.cache.character.Torso["Left Shoulder"],
- nocol.cache.character.Torso.Grip
- }
- local camx, camy, camz, camw, t, dt = false, nil, nil, nil, nil, nil
- nocol.cache.run:BindToRenderStep("weapon.step", Enum.RenderPriority.Camera.Value + 1, function()
- if nocol.springs.fire.t ~= v3() and (nocol.springs.fire.p - nocol.springs.fire.t).magnitude < 1 then
- nocol.springs.fire.t = v3()
- nocol.springs.fire.s = 25
- nocol.springs.fire.d = 0.5
- nocol.springs.cam.d = 0.4
- nocol.springs.cam.t = v3()
- end
- nocol.cache.cspace = math.floor(nocol.cache.lerp(nocol.cache.cspace, nocol.springs.fire.p.magnitude * 100, 0.3))
- nocol.cache.gui.Crosshair.Position = UDim2.new(0, nocol.cache.mouse.X - nocol.cache.gap / 2 - nocol.cache.cspace / 2, 0, nocol.cache.mouse.Y - nocol.cache.gap / 2 - nocol.cache.cspace / 2)
- nocol.cache.gui.Crosshair.Size = UDim2.new(0, nocol.cache.gap + nocol.cache.cspace, 0, nocol.cache.gap + nocol.cache.cspace)
- camx = nocol.springs.cam.p.X / 6
- camy = nocol.springs.cam.p.Z / 3
- camz = nocol.springs.cam.p.Z / 3
- nocol.cache.camera.CFrame = nocol.cache.camera.CFrame * ang(camx, camy, camz)
- nocol.cache.rig[1].C0 = rdef * cfr(-3 * nocol.springs.fire.p.X, nocol.springs.fire.p.Y, nocol.springs.fire.p.X) * ang(nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4 + nocol.springs.fire.p.Y, nocol.springs.fire.p.X)
- nocol.cache.rig[2].C0 = ldef * cfr(3 * nocol.springs.fire.p.X, nocol.springs.fire.p.Y, nocol.springs.fire.p.X) * ang(0.65 * nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4, -nocol.springs.fire.p.X)
- nocol.cache.rig[3].C0 = cfr(0, nocol.springs.fire.p.Y, nocol.springs.fire.p.X * 3) * ang(nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4, 0)
- if nocol.cache.mdown then
- t = tick()
- if self.__tick < t then
- self.__tick = t + self.rpm
- if 0 < self.__state.ammo[1] and self.__state.state == "idle" and 0 < nocol.cache.character.Humanoid.Health and self.__state.equipped then
- nocol.springs.fire.s = 70
- nocol.springs.fire.d = 1
- nocol.springs.fire.t = v3(self.recoil.X, self.recoil.Y, nocol.cache.rnd(-10, 10) / 10 * self.recoil.Z)
- camw = false
- nocol.springs.cam.d = 0.9
- nocol.springs.cam.s = 40
- nocol.springs.cam.t = nocol.springs.fire.t
- for _, particle in pairs(self.bin.Barrel:children()) do
- if particle:IsA("ParticleEmitter") then
- particle:Emit(particle.Rate)
- elseif particle:IsA("PointLight") then
- particle.Enabled = true
- delay(0.05, function()
- particle.Enabled = false
- end)
- end
- end
- do
- local damage_table = {}
- for i = 1, self.amount do
- local dist = (self.bin.Barrel.CFrame.p - nocol.cache.mouse.Hit.p).magnitude
- local spread = nocol.cache.vc3(nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist, nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist, nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist)
- nocol.classes.bullet.new({
- origin = self.bin.Barrel.CFrame.p,
- direction = (self.bin.Barrel.CFrame.p - nocol.cache.mouse.Hit.p + spread).unit,
- part = self.bin.Barrel,
- bullet = self.bullet.type or "normal",
- thickness = self.bullet.thickness or 0.1,
- velocity = self.bullet.velocity or 2000,
- anchor = self.bin.Barrel,
- audio = self.audio.fire,
- onanchor = function(sd)
- if not self.audrep and sd and sd.anchor then
- do
- local s = Instance.new("Sound")
- s.SoundId = sd.audio
- s.Volume = self.volume
- s.Pitch = math.random(9.5, 11) / 10
- s.Parent = sd.anchor
- delay(wait(), function()
- s:Play()
- end)
- game.Debris:AddItem(s, s.TimeLength + wait())
- end
- end
- end,
- onhit = function(v, pos)
- if self.onhit then
- self.onhit(v, pos)
- end
- local hum = v.Parent:FindFirstChild("Humanoid") or v.Parent.Parent:FindFirstChild("Humanoid")
- if hum then
- if game.Players:FindFirstChild(hum.Parent.Name) then
- if (game.Players[hum.Parent.Name].TeamColor ~= nocol.cache.player.TeamColor or self.teamkill) and not damage_table[hum] then
- damage_table[hum] = true
- local s = Instance.new("Sound", workspace.CurrentCamera)
- s.SoundId = "rbxassetid://160432334"
- s:Play()
- game.Debris:AddItem(s, 1)
- nocol.network.call("register_hit", hum, self.dmg * ((v.Name == "Head" or v.Name == "Handle") and self.hs or 1))
- end
- elseif not damage_table[hum] then
- damage_table[hum] = true
- local s = Instance.new("Sound", workspace.CurrentCamera)
- s.SoundId = "rbxassetid://160432334"
- s:Play()
- game.Debris:AddItem(s, 1)
- nocol.network.call("register_hit", hum, self.dmg * ((v.Name == "Head" or v.Name == "Handle") and self.hs or 1))
- end
- end
- if (pos - nocol.cache.camera.CFrame.p).magnitude < 500 then
- local e = nocol.classes.effect.new("SmallSmoke")
- e:emit(pos, 20)
- end
- end
- })
- end
- self:set(self.__state.ammo, 1, self.__state.ammo[1] - 1)
- end
- elseif self.autism then
- self.autism:Stop()
- self.autism:Destroy()
- self.autism = nil
- end
- if self.firemode == "single" then
- nocol.cache.mdown = false
- if self.autism then
- self.autism:Stop()
- self.autism:Destroy()
- self.autism = nil
- end
- elseif self.firemode == "bolt" then
- nocol.cache.mdown = false
- if 0 < self.__state.ammo[1] then
- self:animate("bolt", true, 0.2)
- end
- end
- end
- end
- end)
- nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.mouse.Button1Down:connect(function()
- nocol.cache.mdown = true
- if self.onfire then
- self.onfire()
- end
- end)
- nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.mouse.Button1Up:connect(function()
- nocol.cache.mdown = false
- if self.autism then
- self.autism:Stop()
- self.autism:Destroy()
- self.autism = nil
- end
- end)
- nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.input.InputBegan:connect(function(obj, eh)
- if eh then
- return
- end
- if obj.UserInputType == Enum.UserInputType.Keyboard then
- if obj.KeyCode == Enum.KeyCode.R then
- if self.__state.state ~= "reloading" then
- self.__state.state = "reloading"
- if self.firemode == "bolt" then
- self:animate("bolt", true, 0.2).Stopped:wait()
- end
- if self.onrel then
- self.onrel()
- end
- local anim = self:animate("reload", true, 0.3, 0.8)
- anim.Stopped:connect(function()
- if self.__state.equipped and self.__state.state == "reloading" then
- self:set(self.__state.ammo, 1, self.__state.ammo[2])
- self.__state.state = "idle"
- end
- end)
- end
- elseif obj.KeyCode == Enum.KeyCode.F then
- if not self.__anims.atease then
- return
- end
- if self.__state.state ~= "reloading" then
- if self.__state.state ~= "atease" then
- if self.__anims.stnc1 then
- self:animate("stnc1", false, 0.3)
- end
- nocol.cache.character.Humanoid.WalkSpeed = 20
- local anim = self:animate("atease", true, 0.3, 1)
- self.__state.state = "atease"
- else
- self:animate("atease", false, 0.3)
- self.__state.state = "idle"
- nocol.cache.character.Humanoid.WalkSpeed = 16
- end
- end
- elseif obj.KeyCode == Enum.KeyCode.G then
- if not self.__anims.stnc1 then
- return
- end
- if self.__state.state ~= "reloading" then
- if self.__state.state ~= "stnc1" then
- if self.__anims.atease then
- self:animate("atease", false, 0.3)
- end
- local anim = self:animate("stnc1", true, 0.3, 1)
- self.__state.state = "stnc1"
- else
- self:animate("stnc1", false, 0.3)
- self.__state.state = "idle"
- end
- end
- end
- end
- end)
- end
- end
- end
- function nocol.classes.tool:unequipped()
- if nocol.cache.gui then
- nocol.cache.gui:Destroy()
- nocol.cache.gui = nil
- end
- nocol.cache.input.MouseIconEnabled = true
- if nocol.cache.rig then
- if nocol.cache.rig[1] then
- nocol.cache.rig[1].C0 = rdef
- end
- if nocol.cache.rig[2] then
- nocol.cache.rig[2].C0 = ldef
- end
- if nocol.cache.rig[3] then
- nocol.cache.rig[3].C0 = cfr()
- end
- end
- if self.autism then
- self.autism:Stop()
- self.autism:Destroy()
- self.autism = nil
- end
- for event_id = 1, #nocol.classes.tool.events do
- if nocol.classes.tool.events[event_id] then
- nocol.classes.tool.events[event_id]:disconnect()
- nocol.classes.tool.events[event_id] = nil
- end
- end
- nocol.cache.run:UnbindFromRenderStep("weapon.step")
- for animation_index, id in pairs(self.__anims) do
- self:animate(animation_index, false, 0.2)
- end
- self.__state.state = "idle"
- self.__state.equipped = false
- end
- nocol.cache.character = waitfor(workspace, nocol.cache.player.Name)
- nocol.cache.hump = waitfor(nocol.cache.character, "HumanoidRootPart")
- nocol.cache.backpack.ChildAdded:connect(function(tool)
- tool:WaitForChild("NoCol", 3)
- if tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol") and not nocol.classes.tool.container[tool] then
- nocol.classes.tool.new(tool)
- end
- end)
- nocol.cache.player.Chatted:connect(function(msg)
- if string.sub(msg, 1, 5) == "size/" then
- local size = tonumber(string.sub(msg, 6))
- nocol.cache.gap = size
- end
- end)
- nocol.cache.character.ChildAdded:connect(function(tool)
- local tool = not (tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol")) or nocol.classes.tool.container[tool] or nocol.classes.tool.new(tool)
- end)
- nocol.cache.character.Humanoid.Died:connect(function()
- nocol.cache.func.Parent = game.ReplicatedStorage
- end)
- for _, tool in pairs(nocol.cache.backpack:children()) do
- if tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol") and not nocol.classes.tool.container[tool] then
- nocol.classes.tool.new(tool)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment