Advertisement
EmeraldIT

Untitled

Apr 10th, 2023 (edited)
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 16.24 KB | None | 0 0
  1. local plr = owner
  2. local ch = owner.Character
  3. local hum = ch.Humanoid
  4. local root = ch.HumanoidRootPart
  5. local mode = "Blessing"
  6. local bullets = {}
  7. local mPos = nil
  8. local tracking = false
  9. local CF = CFrame.new
  10. local ANG = CFrame.Angles
  11. local RAN = math.random
  12. local C3 = Color3.new
  13. local RGB = Color3.fromRGB
  14. local VT = Vector3.new
  15. local UD = UDim2.new
  16. local SEQ = NumberSequence.new
  17. local CSEQ = ColorSequence.new
  18. local NKEY = NumberSequenceKeypoint.new
  19. local RANGE = NumberRange.new
  20.  
  21. --_________________MISC (FOLDERS)___________________________
  22.  
  23. local attackFolder = Instance.new("Folder")
  24. attackFolder.Parent = ch
  25.  
  26. --__________________CORE FUNCTIONS___________________________
  27.  
  28. local function hwait(t)
  29.     if t then
  30.         for i = 1,t do
  31.             game:GetService("RunService").Stepped:Wait()
  32.         end
  33.     else
  34.         return game:GetService("RunService").Stepped:Wait()
  35.     end
  36. end
  37.  
  38. local createSeq = function(stuffs)
  39.     a = {}
  40.     for i,v in pairs(stuffs) do
  41.         table.insert(a, NumberSequenceKeypoint.new(v.Time, v.Val))
  42.     end
  43.     return NumberSequence.new(a)
  44. end
  45.  
  46. local function randneg(num1, num2)
  47.     times = 1
  48.     if math.random(1,2) == 1 then
  49.         times = 1
  50.     else
  51.         times = -1
  52.     end
  53.     return math.random(num1, num2)*times
  54. end
  55.  
  56. local function castRay(startPos, endPos)
  57.     local results = workspace:Raycast(startPos, endPos)
  58.     if results then
  59.         return results
  60.     else return nil
  61.     end
  62. end
  63.  
  64. local curl = function(part, angle, duration)
  65.     local push = 5
  66.     for i = 1,duration*50 do
  67.         push = push - 0.1
  68.         part.CFrame = part.CFrame:Lerp(part.CFrame * angle, 0.1)
  69.         part.CFrame = part.CFrame:Lerp(part.CFrame * CFrame.new(math.random(5, 20)/2, math.random(15, 30)/2 + push, math.random(5, 20)/2), 0.2)
  70.         hwait()
  71.     end
  72. end
  73.  
  74.  
  75. function make(inst, parent, details)
  76.     local Item = Instance.new(inst)
  77.     if details then
  78.         for i,v in pairs(details) do
  79.             Item[i] = v
  80.         end
  81.     end
  82.     Item.Parent = parent or nil
  83.     return Item
  84. end
  85.  
  86. function clone(part, col, aftersize, aftercol)
  87.     if not part:IsA("SpecialMesh") then
  88.         local p = make("Part", workspace, {Anchored = true, CanCollide = false, Shape = part.Shape, CFrame = part.CFrame, Material = "Neon", Name = "Clone piece", Color = col})
  89.         if part.Name ~= "Head" then
  90.             p.Size = part.Size + Vector3.new(.02,.02,.02)
  91.         else
  92.             p.Size = Vector3.new(1,1,1) + Vector3.new(.02,.02,.02)
  93.         end
  94.         spawn(function()
  95.             for i = 1,15 do
  96.                 p.Transparency = i/15
  97.                 if aftersize then
  98.                     p.Size = p.Size:Lerp(aftersize, 0.1)
  99.                 end
  100.                 if aftercol then
  101.                     p.Color = p.Color:Lerp(aftercol, 0.1)
  102.                 end
  103.                 task.wait()
  104.             end
  105.             p:Remove()
  106.         end)
  107.     else
  108.         local p = make("Part", workspace, {Anchored = true, CanCollide = false, CFrame = part.Parent.CFrame, Material = "Neon", Name = "Clone piece", Color = col})
  109.         if part.Parent.Name ~= "Head" then
  110.             p.Size = part.Parent.Size + Vector3.new(.02,.02,.02)
  111.         else
  112.             p.Size = Vector3.new(1,1,1) + Vector3.new(.02,.02,.02)
  113.         end
  114.         pm = make("SpecialMesh", p, {MeshType = "Sphere"})
  115.         spawn(function()
  116.             for i = 1,15 do
  117.                 p.Transparency = i/15
  118.                 if aftersize then
  119.                     p.Size = p.Size:Lerp(aftersize, 0.1)
  120.                 end
  121.                 if aftercol then
  122.                     p.Color = p.Color:Lerp(aftercol, 0.1)
  123.                 end
  124.                 task.wait()
  125.             end
  126.             p:Remove()
  127.         end)
  128.     end
  129. end
  130.  
  131. --_______________TOOL FUNCTIONALITY PT1.______________________
  132.  
  133. local tool = Instance.new("Tool")
  134. local handle = Instance.new("Part")
  135. handle.Transparency = 1
  136. handle.CanCollide = false
  137. handle.Name = "Handle"
  138. handle.Parent = tool
  139. tool.Name = "Blight v Blessing"
  140.  
  141. local ev = Instance.new("RemoteEvent")
  142. ev.Name = "KeyDownEv"
  143. ev.Parent = tool --just to make sure its removed by g/no.sr
  144.  
  145. LOCAL = [[
  146. local plr = owner
  147. local ev = (function() if plr.Backpack:FindFirstChild("Blight v Blessing") then return plr.Backpack["Blight v Blessing"]:WaitForChild("KeyDownEv") elseif plr.Character:FindFirstChild("Blight v Blessing") then return plr.Character["Blight v Blessing"]:WaitForChild("KeyDownEv") end end)()
  148. local mouse = plr:GetMouse()
  149. local hold = false
  150. local mode = "Blessing"
  151. local modes = {
  152.     {mode = "Blessing", msg = "+ Blessing mode initiated. +", dedikey = "z", desc = "Second most fling force. Heals 10-20 HP."},
  153.     {mode = "Blight", msg = "x Blight mode engaged. x", dedikey = "x", desc = "Does less fling force than Blessing and does 10-20 HP worth of damage."},
  154.     {mode = "Death", msg = "! Insta-death mode activated. !", dedikey = "c", desc = "Does the most fling force - sending most to the deadzone (floating point limit). Does no damage."},
  155.     {mode = "Combustion", msg = "* Combustion mode loaded. *", dedikey = "v", desc = "Causes the head of anyone hit to explode. Usually not survivable..."},
  156.     {mode = "Clean", msg = "$ Cleaner mode hired. $", dedikey = "b", desc = "Cleans up/removes unanchored parts. Mostly for when Val (mald) joins and summons his endless list of friends."}
  157. }
  158. local keys = {"z", "x", "c", "v", "b"}
  159.  
  160. function newOwner()
  161.     print("Hello "..(plr.DisplayName or plr.Name).."!")
  162.     print("Click to attack, and hold Q to aim!")
  163.     print("Modes: ")
  164.     for i,v in pairs(modes) do
  165.         print(v["mode"].." ("..v["dedikey"].."): "..v["desc"])
  166.     end
  167. end
  168.  
  169. mouse.KeyDown:Connect(function(key)
  170.     if key == "z" then
  171.         mode = "Blessing"
  172.     elseif key == "x" then
  173.         mode = "Blight"
  174.     elseif key == "c" then
  175.         mode = "Death"
  176.     elseif key == "v" then
  177.         mode = "Combustion"
  178.     elseif key == "b" then
  179.         mode = "Clean"
  180.     elseif key == "q" then
  181.         hold = true
  182.         print("= Tracking mouse! =")
  183.         spawn(function()
  184.             repeat
  185.                 task.wait()
  186.                 ev:FireServer("Tracking", mouse.hit)
  187.             until hold == false
  188.             ev:FireServer("NotTracking")
  189.             print("- Tracking complete! -")
  190.         end)
  191.     end
  192.  
  193.     if k ~= "q" and table.find(keys, key) then
  194.         ev:FireServer("Switch", mode)
  195.         for i,v in pairs(modes) do
  196.             if v["mode"] == mode then
  197.                 print(v["msg"])
  198.             end
  199.         end
  200.     end
  201. end)
  202.  
  203. mouse.KeyUp:Connect(function()
  204.     hold = false
  205. end)
  206.  
  207. newOwner()
  208. ]]
  209. tool.Parent = plr.Backpack
  210.  
  211. --_______________________ATTACKS.________________________
  212.  
  213. local pte = function(parent, lightemission, lightinfluence, color, transparency, drag, locked, accel, rate, lifetime, rotspeed, rotation, spread, speed, size, texture, z, direction, enabled)
  214.     local pe = Instance.new("ParticleEmitter")
  215.     pe.LightEmission = lightemission
  216.     pe.LightInfluence = lightinfluence
  217.     pe.Color = color
  218.     pe.Size = size
  219.     pe.Transparency = transparency
  220.     pe.ZOffset = z
  221.     pe.EmissionDirection = direction
  222.     pe.Rate = rate
  223.     pe.LockedToPart = locked
  224.     pe.Acceleration = accel or Vector3.new(0,0,0)
  225.     pe.Lifetime = lifetime
  226.     pe.RotSpeed = rotspeed
  227.     pe.Rotation = rotation
  228.     pe.SpreadAngle = spread
  229.     pe.Speed = speed
  230.     pe.Texture = texture
  231.     pe.Enabled = enabled
  232.     pe.Drag = drag
  233.     pe.Parent = parent
  234.     return pe
  235. end
  236.  
  237. function trailburst(place, color1, color2)
  238.     local orr = place
  239.     for i = 1,50 do
  240.         local trail = Instance.new("Trail")
  241.         trail.FaceCamera = true
  242.         trail.LightEmission = (function()
  243.             _,_,v = color1:ToHSV()
  244.             return v
  245.         end)()
  246.         trail.WidthScale =  createSeq({{Time = 0, Val = 0}, {Time = 0.35, Val = 1}, {Time = 1, Val = 2}})
  247.         trail.Color = ColorSequence.new(color1)
  248.         trail.Transparency = createSeq({{Time = 0, Val = 1}, {Time = 0.2, Val = 0}, {Time = 1, Val = 1}})
  249.         trail.Lifetime = .25
  250.         local p = Instance.new("Part")
  251.         local li = Instance.new("PointLight")
  252.         li.Color = color1
  253.         li.Parent = p
  254.         p.Transparency = 1
  255.         p.CanCollide = false
  256.         p.Anchored = true
  257.         p.CFrame = orr * CFrame.Angles(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))
  258.         trail.Parent = p
  259.         att = Instance.new("Attachment", p)
  260.         att.Position = Vector3.new(0,1,0)
  261.         att2 = Instance.new("Attachment", p)
  262.         att2.Position = Vector3.new(0,-1,0)
  263.         trail.Attachment0 = att
  264.         trail.Attachment1 = att2
  265.         p.Parent = script
  266.         spawn(function()
  267.             for i = 1,3 do
  268.                 curl(p, CFrame.Angles(math.rad(randneg(40, 50)),math.rad(randneg(40, 50)),math.rad(randneg(40, 50))), 1)
  269.                 hwait()
  270.             end
  271.             trail.Enabled = false
  272.             game.Debris:AddItem(p, 1)
  273.         end)
  274.     end
  275. end
  276.  
  277. function contact_explosion(size, origin, place, effect)
  278.     local blast = Instance.new("Part")
  279.     local spM = Instance.new("SpecialMesh", blast)
  280.     spM.MeshType = "Sphere"
  281.     blast.Material = "Neon"
  282.     blast.Color = origin.Color
  283.     blast.Anchored = true
  284.     blast.CanCollide = false
  285.     blast.Size = Vector3.new(10, 10, 10)
  286.     blast.Position = place
  287.     blast.Parent = attackFolder
  288.    
  289.     spawn(function()
  290.         trailburst(origin.CFrame, origin.Color)
  291.     end)
  292.                
  293.     blast.Touched:Connect(function(h)
  294.         if h.Anchored == false and not h.Parent:FindFirstChild("Humanoid") and not h.Parent.Parent:FindFirstChild("Humanoid") and effect and effect == "Remove" then
  295.             clone(h, Color3.new(1, 0.6, 1), Vector3.new(0,0,0))
  296.             h:Remove()
  297.         end
  298.     end)
  299.    
  300.     spawn(function()
  301.         for _, player in pairs(game.Players:GetChildren()) do
  302.                 dist = player:DistanceFromCharacter(blast.Position)
  303.             if dist <= (100 + size + math.random(3,30 + (size/10)*3))/2 then --and not effected[player.Name]
  304.                 --effected[player.Name] = true
  305.                 if effect and effect == "Damage" then
  306.                     local bv = Instance.new("BodyVelocity")
  307.                     bv.Velocity = Vector3.new(math.random(-500, 500), math.random(0, 200), math.random(-500, 500))/2
  308.                     bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  309.                     pcall(function()
  310.                         bv.Parent = player.Character.Head
  311.                         if player.Character:FindFirstChildOfClass("ForceField") then player.Character:FindFirstChildOfClass("ForceField"):Remove() end
  312.                         if player.Character.Humanoid:FindFirstChildOfClass("ForceField") then player.Character.Humanoid:FindFirstChildOfClass("ForceField"):Remove() end
  313.                         player.Character.Humanoid:TakeDamage(math.random(30, 50))
  314.                     end)
  315.                     game.Debris:AddItem(bv, 0.2)
  316.                 elseif effect and effect == "Evicerate" then
  317.                     local bv = Instance.new("BodyVelocity")
  318.                     bv.Velocity = Vector3.new(math.random(-50000000, 50000000), math.random(0, 20000000), math.random(-50000000, 50000000))
  319.                     bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  320.                     pcall(function()
  321.                         bv.Parent = player.Character.Head
  322.                     end)
  323.                     game.Debris:AddItem(bv, 0.2)
  324.                 elseif effect and effect == "Explode" then
  325.                     local bv = Instance.new("BodyVelocity")
  326.                     bv.Velocity = Vector3.new(math.random(-500, 500), math.random(0, 200), math.random(-500, 500))
  327.                     bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  328.                     pcall(function()
  329.                         if player.Character:FindFirstChildOfClass("ForceField") then player.Character:FindFirstChildOfClass("ForceField"):Remove() end
  330.                         if player.Character.Humanoid:FindFirstChildOfClass("ForceField") then player.Character.Humanoid:FindFirstChildOfClass("ForceField"):Remove() end
  331.                         bv.Parent = player.Character.Head
  332.                         local ex = Instance.new("Explosion")
  333.                         ex.Visible = false
  334.                         ex.Position = player.Character.Head.Position
  335.                         ex.Parent = workspace
  336.                     end)
  337.                     game.Debris:AddItem(bv, 0.2)
  338.                 elseif effect and effect == "Remove" then
  339.                     local bv = Instance.new("BodyVelocity")
  340.                     bv.Velocity = Vector3.new(math.random(-250, 250), math.random(0, 100), math.random(-250, 250))
  341.                     bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  342.                     pcall(function()
  343.                         bv.Parent = player.Character.Head
  344.                     end)
  345.                     game.Debris:AddItem(bv, 0.2)
  346.                 else
  347.                     local bv = Instance.new("BodyVelocity")
  348.                     bv.Velocity = Vector3.new(math.random(-500, 500), math.random(0, 200), math.random(-500, 500))
  349.                     bv.MaxForce = Vector3.new(1e9, 1e9, 1e9)
  350.                     pcall(function()
  351.                         bv.Parent = player.Character.Head
  352.                         player.Character.Humanoid:TakeDamage(-math.random(10, 20)) 
  353.                     end)
  354.                     game.Debris:AddItem(bv, 0.2)
  355.                 end
  356.             end
  357.         end
  358.         for new_i = 1, 20 do
  359.             blast.Size = blast.Size:Lerp(Vector3.new(100 + size + math.random(3,30 + (size/10)*3), 100 + size + math.random(3,30 + (size/10)*3), 100 + size + math.random(3,30 + (size/10)*3)), 0.2)
  360.             hwait()
  361.             blast.Transparency = new_i/20
  362.         end
  363.         blast:Remove()
  364.     end)
  365. end
  366.  
  367. local function fly(item, position)
  368.     if tracking then
  369.         local bg = item.BodyGyro
  370.         item.Anchored = false
  371.         bg.MaxTorque = Vector3.new(9000,9000,9000)
  372.         bg.D = math.clamp(bg.D - 1, 50, math.huge)
  373.         bg.P = math.clamp(bg.P + 2, 100, 5000)
  374.         bg.CFrame = CFrame.new(item.Position, mPos.p)
  375.         local direction = item.CFrame.lookVector * 100
  376.         local position = position + direction
  377.         local err = position - item.Position
  378.         item.Velocity = 5*err
  379.     else
  380.         item.Anchored = true
  381.         item.BodyGyro.MaxTorque = Vector3.new(0,0,0)
  382.         item.BodyGyro.D = 200
  383.         item.BodyGyro.P = 1500
  384.         item.CFrame = item.CFrame * CFrame.new(0, 0, -10)
  385.     end
  386. end
  387.  
  388. function blast()
  389.     local bullet = Instance.new("Part")
  390.     local spM = Instance.new("SpecialMesh", bullet)
  391.     spM.MeshType = "Sphere"
  392.     local ty = Instance.new("StringValue")
  393.     ty.Name = "Type"
  394.     ty.Parent = bullet
  395.     bullet.Name = "Active"
  396.     bullet.Anchored = true
  397.     bullet.CanCollide = false
  398.     bullet.Material = "Neon"
  399.     bullet.Size = Vector3.new(2,2,2)
  400.     bullet.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) --the root is always backward for some reason.
  401.     bullet.Color = (function()
  402.         if mode == "Blessing" then
  403.             ty.Value = "Heal"
  404.             return Color3.new(.5, 1, .5)
  405.         elseif mode == "Death" then
  406.             ty.Value = "Evicerate"
  407.             return Color3.new(.4, .4, .4)
  408.         elseif mode == "Combustion" then
  409.             ty.Value = "Explode"
  410.             return Color3.new(1, .5, 0)
  411.         elseif mode == "Clean" then
  412.             ty.Value = "Remove"
  413.             return Color3.new(1, .5, 1)
  414.         else
  415.             ty.Value = "Damage"
  416.             return Color3.new(.2, 0, 0)
  417.         end
  418.     end)()
  419.     local bg  = Instance.new("BodyGyro")
  420.     bg.D = 200
  421.     bg.P = 1500
  422.     bg.Name = "BodyGyro"
  423.     bg.MaxTorque = Vector3.new(0,0,0)
  424.     bg.Parent = bullet
  425.     attach = make("Attachment", bullet, {Position = Vector3.new(0,bullet.Size.Y/2,0)})
  426.     attach2 = make("Attachment", bullet, {Position = Vector3.new(0,-bullet.Size.Y/2,0)})
  427.     trail = Instance.new("Trail")
  428.     trail.FaceCamera = true
  429.     trail.LightEmission = (function()
  430.         _,_,v = bullet.Color:ToHSV()
  431.         return v
  432.     end)()
  433.     trail.Color = ColorSequence.new(bullet.Color)
  434.     trail.Transparency = NumberSequence.new({
  435.         NumberSequenceKeypoint.new(0,0),
  436.         NumberSequenceKeypoint.new(0.5,0),
  437.         NumberSequenceKeypoint.new(1,1)
  438.     })
  439.     trail.WidthScale = NumberSequence.new({
  440.         NumberSequenceKeypoint.new(0,1),
  441.         NumberSequenceKeypoint.new(1,0)})
  442.     trail.Lifetime = 1
  443.     trail.Parent = bullet
  444.     trail.Attachment0 = attach
  445.     trail.Attachment1 = attach2
  446.     bullet.Parent = attackFolder
  447.  
  448.     spawn(function()
  449.         --charge
  450.         for i = 1, 20 do
  451.             bullet.Size = bullet.Size:Lerp(Vector3.new(math.random(3,5), math.random(3,5), math.random(3,5)), 0.2)
  452.             hwait()
  453.         end
  454.         bullet.Size = Vector3.new(0,0,0)
  455.         bullet.Transparency = 1
  456.         local pt = pte(bullet, trail.LightEmission, 0, CSEQ(bullet.Color), SEQ({NKEY(0,0), NKEY(1,0)}), 0, true, nil, 100, NumberRange.new(.1), NumberRange.new(100), NumberRange.new(0), Vector2.new(0), NumberRange.new(0), SEQ({NKEY(0,0),NKEY(0.2,10),NKEY(0.8,10),NKEY(1,0)}), "rbxassetid://2273224484", 3, "Top", true)
  457.         table.insert(bullets, bullet)
  458.         game.Debris:AddItem(bullet, 5)
  459.     end)
  460. end
  461.  
  462. game:GetService("RunService").Stepped:Connect(function()
  463.     for i,item in pairs(bullets) do
  464.         if item and item:IsDescendantOf(workspace) and item.Name == "Active" then
  465.             local res = castRay(item.CFrame.p, (item.CFrame * CFrame.new(0, 0, -10)).p)
  466.             if (res and res.Position) and (res.Instance and not res.Instance:IsDescendantOf(plr.Character) and not res.Instance:IsDescendantOf(script)) then
  467.                 contact_explosion(0, item, res.Position, item.Type.Value)
  468.             end
  469.             fly(item, item.Position)
  470.         elseif not item:IsDescendantOf(workspace) then
  471.             bullets[i] = nil
  472.         end
  473.     end
  474. end)
  475.  
  476. --_____________________EVENT BINDING STUFF.____________________
  477.  
  478. ev.OnServerEvent:Connect(function(pl, cmd, newMode)
  479.     if cmd == "Switch" then
  480.         mode = newMode
  481.         --will set mode to whatever was fired to the server in that local script.
  482.     elseif cmd == "Tracking" then
  483.         tracking = true
  484.         mPos = newMode
  485.     elseif cmd == "NotTracking" then
  486.         tracking = false
  487.         mPos = CFrame.new(0, 10000, 0)
  488.     end
  489. end)
  490.  
  491. tool.Activated:Connect(function()
  492.     blast()
  493. end)
  494.  
  495. tool.AncestryChanged:Connect(function()
  496.     if tool.Parent:IsA("Model") and game.Players:GetPlayerFromCharacter(tool.Parent) and game.Players:GetPlayerFromCharacter(tool.Parent) ~= plr then
  497.         plr = game.Players:GetPlayerFromCharacter(tool.Parent)
  498.         attackFolder.Parent = plr.Character
  499.         NLS(LOCAL, plr.Character)
  500.     end
  501. end)
  502.  
  503. script.Parent = tool
  504. NLS(LOCAL, plr.Character)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement