Advertisement
aarontje11002

dubstep gun

Mar 17th, 2015
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function clerp(c1,c2,al)
  2.     local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
  3.     local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  4.     for i,v in pairs(com1) do
  5.         com1[i] = v+(com2[i]-v)*al
  6.     end
  7.     return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
  8. end
  9.  
  10. plr = game:service'Players'.LocalPlayer
  11. char = plr.Character
  12. mouse = plr:GetMouse()
  13. humanoid = char:findFirstChild("Humanoid")
  14. torso = char:findFirstChild("Torso")
  15. head = char.Head
  16. ra = char:findFirstChild("Right Arm")
  17. la = char:findFirstChild("Left Arm")
  18. rl = char:findFirstChild("Right Leg")
  19. ll = char:findFirstChild("Left Leg")
  20. rs = torso:findFirstChild("Right Shoulder")
  21. ls = torso:findFirstChild("Left Shoulder")
  22. rh = torso:findFirstChild("Right Hip")
  23. lh = torso:findFirstChild("Left Hip")
  24. neck = torso:findFirstChild("Neck")
  25. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  26. anim = char:findFirstChild("Animate")
  27. do --Removing ROBLOX's new Looped bug >_>
  28.             local function rec(x)
  29.                 for i,v in pairs(x:children()) do
  30.                     if v:IsA'Animation' then
  31.                         v.AnimationId = 'rbxassetid://28159255'
  32.                     end
  33.                     rec(v)
  34.                 end
  35.             end
  36.             rec(anim) --the Animate script
  37.         end
  38.  
  39.         humanoid.Jump = true
  40.  
  41.         wait(.4)
  42.  
  43.  
  44.         if anim then
  45.         anim:Destroy()
  46.         end
  47. rootpart = char:findFirstChild("HumanoidRootPart")
  48. camera = workspace.CurrentCamera
  49. modelforparts = char:findFirstChild("ModelForParts") or Instance.new("Model", char)
  50. modelforparts.Name = "ModelForParts"
  51.  
  52. function trailconnect(obj, wat)
  53. local trail = {}
  54. for i = 1, 4 do
  55. local p = Instance.new("Part")
  56. p.BrickColor = obj.BrickColor
  57. p.formFactor = "Custom"
  58. p.Size = Vector3.new(1,1,1)
  59. p.Locked = true
  60. p.Anchored = true
  61. p.CanCollide = false
  62. local mesh = Instance.new("CylinderMesh", p)
  63. mesh.Name = "Mesh"
  64. table.insert(trail,{p,0})
  65. end
  66. local lastpos = obj.Position
  67. local updatethis = 0
  68. local dontdothis = false
  69. game:service'RunService'.Stepped:connect(function()
  70.     if wat == true then if dontdothis then return end
  71.         for i,v in pairs(trail) do
  72.         game:service'Debris':AddItem(obj, 0)
  73.         table.remove(v, i)
  74.         end
  75.         dontdothis = true
  76.         return
  77.     end
  78. updatethis = ((updatethis) % 4) + 1
  79. local dstnc = (obj.Position - lastpos).magnitude
  80. trail[updatethis][1].Mesh.Scale = Vector3.new(.2,dstnc,.2)
  81. trail[updatethis][1].Parent = obj.Parent
  82. trail[updatethis][1].CFrame = CFrame.new((obj.Position + lastpos)/2,obj.Position) * CFrame.Angles(math.pi/2, 0, 0)
  83. trail[updatethis][2] = 0
  84. for i,v in pairs(trail) do
  85. v[2] = v[2] + .15
  86. v[1].Transparency = v[2]
  87. end
  88. lastpos = obj.Position
  89. end)
  90. end
  91.  
  92. do --rayCast
  93.     function rayCast(startpos, Speed, Gravity, Dmg, color)
  94.         local ran,err = ypcall(function()
  95.     local rayPart         = Instance.new("Part")
  96.     rayPart.Name          = "RayPart"
  97.     rayPart.BrickColor    = BrickColor.new(color)
  98.     rayPart.Anchored      = true
  99.     rayPart.CanCollide    = false
  100.     rayPart.Locked        = true
  101.     rayPart.FormFactor    = "Custom"
  102.     rayPart.TopSurface    = Enum.SurfaceType.Smooth
  103.     rayPart.BottomSurface = Enum.SurfaceType.Smooth
  104.     rayPart.Size          = Vector3.new(.2, 50, .2)
  105.     rayPart:breakJoints()
  106.     Instance.new("CylinderMesh", rayPart)
  107.     local fire = Instance.new("Fire", rayPart)
  108.     fire.Color = rayPart.BrickColor.Color
  109.     fire.SecondaryColor = rayPart.BrickColor.Color
  110.     fire.Heat = 0
  111.     fire.Size = 10
  112.     local pl = Instance.new("PointLight", rayPart)
  113.     pl.Color = Color3.new(rayPart.BrickColor.r/1.5, rayPart.BrickColor.g/1.5, rayPart.BrickColor.b/1.5)
  114.     pl.Range = 18
  115.  
  116.     local hitobj = false
  117.     local bulletposition = startpos.Position
  118.     rayPart.CFrame = startpos.CFrame
  119.     trailconnect(rayPart, hitobj)
  120.  
  121.    local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2)))+( mouse.Hit.p - bulletposition).unit*Speed
  122.     local bulletlastposition = bulletposition
  123.    
  124.     coroutine.resume(coroutine.create(function()
  125.         while true do
  126.  
  127.             local dt = wait()
  128.             bulletlastposition = bulletposition
  129.             bulletvelocity = bulletvelocity + (Vector3.new(0, -3.81*Gravity, 0)*dt)
  130.             bulletposition = bulletposition + (bulletvelocity*dt)
  131.             local ray = Ray.new(bulletlastposition,  (bulletposition - bulletlastposition))
  132.             local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, {char, modelforparts} )
  133.                
  134.     if (torso.Position - rayPart.Position).magnitude > 840 then
  135.         rayPart:Destroy()
  136.         hitobj = true
  137.      break
  138.     end)
  139.  
  140.                 local boom = Instance.new("Part", modelforparts)
  141.                 boom.BrickColor = rayPart.BrickColor
  142.                 boom.Anchored = true
  143.                 boom.FormFactor = "Custom"
  144.                 boom.Size = Vector3.new(1,1,1)
  145.                 boom.CanCollide = false
  146.                 boom.Transparency = 0.25
  147.                 boom.CFrame = CFrame.new(hitposition.x, hitposition.y, hitposition.z)
  148.                 boom.TopSurface = 0
  149.                 boom.BottomSurface = 0
  150.                 local sphere = Instance.new("SpecialMesh", boom)
  151.                 sphere.MeshType = "Sphere"
  152.                 local pl = Instance.new("PointLight", boom)
  153.                 pl.Color = Color3.new(boom.BrickColor.r/1.5, boom.BrickColor.g/1.5, boom.BrickColor.b/1.5)
  154.                 pl.Range = 20
  155.                 for ye = 0, 8 do
  156.                     local lite = Instance.new("Part", boom)
  157.                     lite.FormFactor = "Custom"
  158.                     lite.Size = Vector3.new(.2, 1.5, .2)
  159.                     lite.BrickColor = boom.BrickColor
  160.                     lite.CanCollide = false
  161.                     lite.TopSurface = 0
  162.                     lite.Anchored = false
  163.                     lite.BottomSurface = 0
  164.                     lite.Position = boom.Position + Vector3.new(math.random(-10, 10), math.random(6,15), math.random(-10, 10))
  165.                 end
  166.                    
  167.                 for i = 0, 20, 2.5 do
  168.                     sphere.Scale = sphere.Scale + Vector3.new(i,i,i)
  169.                     boom.Transparency = boom.Transparency + i/60
  170.                     pl.Range = pl.Range + i/15
  171.                  wait()
  172.                 end
  173.                 boom:Destroy()
  174.             for i,v in pairs(workspace:children()) do
  175.                 if v:IsA("Model") and v:findFirstChild("Humanoid") then
  176.                     if v:findFirstChild("Head") and v:findFirstChild("Torso") then
  177.                     if (v:findFirstChild("Torso").Position - boom.Position).magnitude < 16 and v.Name ~= char.Name then
  178.                     v:findFirstChild("Humanoid"):TakeDamage(math.random(Dmg+2,Dmg+6))
  179.                     end
  180.                     end
  181.                 end
  182.                 if v and v:IsA("Part") and v.Name ~= "Base" then
  183.                     if (v.Position - boom.Position).magnitude < 16 then
  184.                     v:BreakJoints()
  185.                     v.TopSurface = 0
  186.                     v.BottomSurface = 0
  187.                     v.LeftSurface = 0
  188.                     v.RightSurface = 0
  189.                     v.FrontSurface = 0
  190.                     v.BackSurface = 0
  191.                     v.Anchored = false
  192.                     end
  193.                 end
  194.         end
  195.             pcall(function()
  196.                 bulletposition = hitposition
  197.                 rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
  198.                 rayPart:Destroy()
  199.             end)
  200.                 break
  201.             end
  202.             rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
  203.             rayPart.Parent = modelforparts
  204.         end
  205.     end))
  206.  for i = 70, 65, -1.5 do
  207.     firing = true
  208.     camera.FieldOfView = i
  209.     wait()
  210. end
  211. for i = 65, 70, 2.5 do
  212.     firing = false
  213.     camera.FieldOfView = i
  214.     wait()
  215. end
  216. end)
  217. if err then
  218.     print(err)
  219.     end
  220. end
  221. end
  222.  
  223.  
  224. charge = 100
  225.  
  226. plrgui = game:service'Players'.LocalPlayer:findFirstChild("PlayerGui")
  227.  
  228. local statusgui = Instance.new("ScreenGui", plrgui)
  229. local mainframe = Instance.new("Frame", statusgui)
  230.     mainframe.Size = UDim2.new(0, 200, 0, 200)
  231.     mainframe.Position = UDim2.new(.75, 0, .75, 0)
  232.     mainframe.Style = 3
  233.     local image = Instance.new("ImageLabel", mainframe)
  234.     image.Size = UDim2.new(1, 0, .47, 0)
  235.     image.Position = UDim2.new(0, 0, .235, 0)
  236.     image.BackgroundTransparency = 1
  237.     image.Image = "rbxassetid://145057975"
  238.     local chargetext = Instance.new("TextLabel", mainframe)
  239.     chargetext.FontSize = "Size18"
  240.     chargetext.Size = UDim2.new(1, 0, .95, 0)
  241.     chargetext.TextYAlignment = "Bottom"
  242.     chargetext.BackgroundTransparency = 1
  243.     chargetext.TextColor3 = Color3.new(1,1,1)
  244.     game:service'RunService'.Stepped:connect(function()
  245.         chargetext.Text = math.floor(charge).."%"
  246.     end)
  247.    
  248.    
  249.  
  250. local rm = Instance.new("Weld", torso)
  251. rm.C0 = CFrame.new(1.5, 0.5, 0)
  252. rm.C1 = CFrame.new(0, 0.5, 0)
  253. rm.Part0 = torso
  254. rm.Part1 = ra
  255. local lm = Instance.new("Weld", torso)
  256. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  257. lm.C1 = CFrame.new(0, 0.5, 0)
  258. lm.Part0 = torso
  259. lm.Part1 = la
  260.  
  261. sound = Instance.new("Sound", head)
  262. sound.Volume = 1
  263. sound.SoundId = "rbxassetid://144834276"
  264. sound.Looped = true
  265.  
  266.  
  267. dancemode = true
  268. debounceofsprint = false
  269.  
  270. --create func
  271. function part(parent, size, color, formfactor, collide, transparency)
  272.     if transparency == nil then transparency=0 end
  273.     if collide == nil then collide=false end
  274.         if formfactor == nil then formfactor="Custom" end
  275.         local p = Instance.new("Part", parent)
  276.         p.FormFactor = formfactor
  277.         p.CanCollide = collide
  278.         p.Size = size
  279.         p.Locked = true
  280.         p.Transparency = transparency
  281.         p.Position = torso.Position + Vector3.new(0, 1, 0)
  282.         p.BrickColor = color
  283.         p.FrontSurface = "SmoothNoOutlines"
  284.         p.BackSurface = "SmoothNoOutlines"        
  285.         p.LeftSurface = "SmoothNoOutlines"
  286.         p.BottomSurface = "SmoothNoOutlines"
  287.         p.TopSurface = "SmoothNoOutlines"  
  288.         p.RightSurface = "SmoothNoOutlines"
  289.         return p
  290. end
  291. function wedge(parent, size, color, formfactor, collide, transparency)
  292.         if transparency==nil then transparency=0 end
  293.     if collide==nil then collide=false end
  294.         if formfactor==nil then formfactor="Custom" end
  295.         local p = Instance.new("WedgePart", parent)
  296.         p.FormFactor = formfactor
  297.         p.CanCollide = collide
  298.         p.Size = size
  299.         p.Locked = true
  300.         p.Position = torso.Position
  301.         p.BrickColor = color
  302.         p.FrontSurface = "SmoothNoOutlines"
  303.         p.BackSurface = "SmoothNoOutlines"        
  304.         p.LeftSurface = "SmoothNoOutlines"
  305.         p.BottomSurface = "SmoothNoOutlines"
  306.         p.TopSurface = "SmoothNoOutlines"  
  307.         p.RightSurface = "SmoothNoOutlines"
  308.         return p
  309. end
  310. function weld(part0, part1, c0, parent, c1)
  311.     if parent == nil then parent=char end
  312.     if c1 == nil then c1=CFrame.new() end
  313.  
  314.         local wel = Instance.new("Weld", parent)
  315.         wel.Part0 = part0
  316.         wel.Part1 = part1
  317.         wel.C0 = c0
  318.         wel.C1 = c1
  319.         return wel
  320. end
  321. function specialmesh(parent, meshType, scale, meshId)
  322.     if meshId==nil then meshId="" end
  323.         local mesh = Instance.new("SpecialMesh", parent)
  324.         mesh.Scale = scale
  325.         mesh.MeshType = meshType
  326.         mesh.MeshId = meshId
  327.         return mesh
  328. end
  329. ----------------------------------------------------------------------------------------------------------
  330. --function part(parent, size, color, formfactor, collide, transparency)
  331. --function weld(part0, part1, c0, parent, c1)
  332.  
  333. ----------------------------------------------------------------------------------------------------------
  334. function animatehuman(animationid, object)
  335.             local animation = object:findFirstChild("Humanoid"):LoadAnimation(animationid)
  336.             animation:Play()
  337. end
  338. local danceAnim = Instance.new("Animation", char)
  339. danceAnim.AnimationId = "http://www.roblox.com/asset/?id=130018893"
  340. danceAnim.Name = "DancingAnimation"
  341. ----------------------------------------------------------------------------------------------------------
  342. local main = Instance.new("Part", char)
  343.         main.FormFactor = "Custom"
  344.         main.CanCollide = false
  345.         main.Size = Vector3.new(.75, 1, 1.2)
  346.         main.Locked = true
  347.         main.BrickColor = BrickColor.new("Black")
  348.         main.TopSurface = 0
  349.         main.BottomSurface = 0
  350.         main.Position = torso.Position
  351.         main:BreakJoints()
  352. local weld1 = weld(main, ra, CFrame.new(), char, CFrame.new(0, -.8, -.6))
  353.     local speaker = Instance.new("Part", char)
  354.         speaker.FormFactor = "Custom"
  355.         speaker.CanCollide = false
  356.         speaker.Size = Vector3.new(1.5, .25, 1.4)
  357.         speaker.Locked = true
  358.         speaker.BrickColor = BrickColor.new("Black")
  359.         speaker.TopSurface = 0
  360.         speaker.BottomSurface = 0
  361.         speaker.Position = torso.Position
  362.         speaker:BreakJoints()
  363. local weld2 = weld(speaker, main, CFrame.new(), char, CFrame.new(-.25, -1.7, .6))
  364.         local speaker2 = Instance.new("Part", char)
  365.         speaker2.FormFactor = "Custom"
  366.         speaker2.CanCollide = false
  367.         speaker2.Size = Vector3.new(1, .25, 2)
  368.         speaker2.Locked = true
  369.         speaker2.BrickColor = BrickColor.new("Black")
  370.         speaker2.TopSurface = 0
  371.         speaker2.BottomSurface = 0
  372.         speaker2.Position = torso.Position
  373.         speaker2:BreakJoints()
  374. local weld3 = weld(speaker2, main, CFrame.new(), char, CFrame.new(0, -1.7, -.2))
  375.         local main2 = Instance.new("Part", char)
  376.         main2.FormFactor = "Custom"
  377.         main2.CanCollide = false
  378.         main2.Size = Vector3.new(.751, 1, .6)
  379.         main2.Locked = true
  380.         main2.BrickColor = BrickColor.new("Black")
  381.         main2.TopSurface = 0
  382.         main2.BottomSurface = 0
  383.         main2.Position = torso.Position
  384.         main2:BreakJoints()
  385. local weld4 = weld(main2, ra, CFrame.new(), char, CFrame.new(0, 0, -.9))
  386.     local main3 = Instance.new("Part", char)
  387.         main3.FormFactor = "Custom"
  388.         main3.CanCollide = false
  389.         main3.Size = Vector3.new(.751, 1.45, 1)
  390.         main3.Locked = true
  391.         main3.BrickColor = BrickColor.new("Black")
  392.         main3.TopSurface = 0
  393.         main3.BottomSurface = 0
  394.         main3.Position = torso.Position
  395.         main3:BreakJoints()
  396. local weld5 = weld(main3, ra, CFrame.new(), char, CFrame.new(0, -1.6, -.9))
  397.     local main4 = Instance.new("Part", char)
  398.         main4.FormFactor = "Custom"
  399.         main4.CanCollide = false
  400.         main4.Size = Vector3.new(1, .76, 1)
  401.         Instance.new("CylinderMesh", main4)
  402.         main4.Locked = true
  403.         main4.BrickColor = BrickColor.new("Black")
  404.         main4.TopSurface = 0
  405.         main4.BottomSurface = 0
  406.         main4.Position = torso.Position
  407.         main4:BreakJoints()
  408. local weld6 = weld(main4, main, CFrame.new(), char, CFrame.new(0, -.15, -.5)*CFrame.Angles(math.pi/2, 0, math.pi/2))
  409.     local speaker3 = Instance.new("Part", char)
  410.         speaker3.FormFactor = "Custom"
  411.         speaker3.CanCollide = false
  412.         speaker3.Size = Vector3.new(1.5, .5, 1.4)
  413.         speaker3.Locked = true
  414.         speaker3.BrickColor = BrickColor.new("Black")
  415.         speaker3.TopSurface = 0
  416.         speaker3.BottomSurface = 0
  417.         speaker3.Position = torso.Position
  418.         speaker3:BreakJoints()
  419. local welds1 = weld(speaker3, main, CFrame.new(), char, CFrame.new(-.25, -2.2, .6))
  420.         local speaker4 = Instance.new("Part", char)
  421.         speaker4.FormFactor = "Custom"
  422.         speaker4.CanCollide = false
  423.         speaker4.Size = Vector3.new(1, .5, 2)
  424.         speaker4.Locked = true
  425.         speaker4.BrickColor = BrickColor.new("Black")
  426.         speaker4.TopSurface = 0
  427.         speaker4.BottomSurface = 0
  428.         speaker4.Position = torso.Position
  429.         speaker4:BreakJoints()
  430. local welds2 = weld(speaker4, main, CFrame.new(), char, CFrame.new(0, -2.205, -.2))
  431.         local speaker5 = Instance.new("Part", char)
  432.         speaker5.FormFactor = "Custom"
  433.         speaker5.CanCollide = false
  434.         speaker5.Size = Vector3.new(1.4, .4, 1.3)
  435.         speaker5.Locked = true
  436.         speaker5.BrickColor = BrickColor.new("Black")
  437.         speaker5.TopSurface = 0
  438.         speaker5.BottomSurface = 0
  439.         speaker5.Position = torso.Position
  440.         speaker5:BreakJoints()
  441. local welds3 = weld(speaker5, main, CFrame.new(), char, CFrame.new(-.25, -2, .6))
  442.         local speaker6 = Instance.new("Part", char)
  443.         speaker6.FormFactor = "Custom"
  444.         speaker6.CanCollide = false
  445.         speaker6.Size = Vector3.new(.9, .4, 1.9)
  446.         speaker6.Locked = true
  447.         speaker6.BrickColor = BrickColor.new("Black")
  448.         speaker6.TopSurface = 0
  449.         speaker6.BottomSurface = 0
  450.         speaker6.Position = torso.Position
  451.         speaker6:BreakJoints()
  452. local welds4 = weld(speaker6, main, CFrame.new(), char, CFrame.new(0, -2, -.2))
  453.    
  454.         local support = Instance.new("Part", char)
  455.         support.FormFactor = "Custom"
  456.         support.CanCollide = false
  457.         support.Size = Vector3.new(.3, .4, .6)
  458.         support.Locked = true
  459.         support.BrickColor = BrickColor.new("Black")
  460.         support.TopSurface = 0
  461.         support.BottomSurface = 0
  462.         support.Position = torso.Position
  463.         support:BreakJoints()
  464. local welds5 = weld(support, main, CFrame.new(), char, CFrame.new(0, -1.5, -.4))
  465.  
  466.  
  467. debounce = false
  468.  
  469. function stopsound()
  470. if debounce then return end
  471.     if not sound.IsPlaying then return end
  472.     sound:stop()
  473.     debounce = true
  474.     local dancebro = Instance.new("StringValue", game:service'Lighting')
  475.     dancebro.Name = ('STOPDANCING'..plr.Name)
  476.     game:service'Debris':AddItem(dancebro, 1)
  477.         coroutine.wrap(function()
  478.         while not sound.IsPlaying do
  479.             if charge <= 100 then
  480.             charge = charge + .1
  481.             wait()
  482.             elseif charge > 100 then
  483.             charge = 100
  484.             break
  485.             end
  486.         end
  487.     end)()
  488.         wait(.1)
  489.     debounce = false
  490. end
  491. mouse.Button1Down:connect(function(mous)
  492.     if debounceofsprint then return end
  493.     if sound.IsPlaying then return end
  494.     if debounce then return end
  495.     sound:play()
  496.  for i = 70, 55, -.35 do
  497.      if not sound.IsPlaying then debounce = true camera.FieldOfView = 70 return end
  498.     camera.FieldOfView = i
  499.     wait()
  500. end
  501. for i = 65, 70, 2.5 do
  502.     if not sound.IsPlaying then debounce = true camera.FieldOfView = 70 return end
  503.     camera.FieldOfView = i
  504.     wait()
  505. end
  506. if debounce then debounce = false return end
  507.     if dancemode then
  508.     for i,v in pairs(workspace:children()) do
  509.         if not sound.IsPlaying then break end
  510.                 coroutine.wrap(function()
  511.                 if v:IsA("Model") and v:findFirstChild("Humanoid") and v.Name ~= char.Name and v:findFirstChild("ModelForParts") == nil and v:findFirstChild("Torso") and (v:findFirstChild("Torso").Position - head.Position).magnitude < 30 then
  512.                         danceAnimClone = danceAnim:clone()
  513.                         danceAnimClone.Parent = v
  514.                         danceAnimClone.AnimationId = "http://www.roblox.com/asset/?id=130018893"
  515.                         wait()
  516.                         NLS([[
  517.                         function animatehuman(animationid, object)
  518.                             local animation = object:findFirstChild("Humanoid"):LoadAnimation(animationid)
  519.                             animation:Play()
  520.                         end
  521.                         while wait(.5) do
  522.                         if game:service'Lighting':findFirstChild("STOPDANCING]]..plr.Name..[[") and game:service'Lighting':findFirstChild("STOPDANCING]]..plr.Name..[["):IsA("StringValue") then game:service'Debris':AddItem(script.Parent:findFirstChild("DancingAnimation"), 5) break end
  523.                         animatehuman(script.Parent:findFirstChild("DancingAnimation"), script.Parent)
  524.                         end
  525.                         ]], v)
  526.                 end
  527.                 end)()
  528.         end
  529. end
  530.     coroutine.wrap(function()
  531.         while sound.IsPlaying do
  532.             if charge <= 1 then
  533.                 if debounce then break end
  534.                 if not sound.IsPlaying then break end
  535.                     sound:stop()
  536.                     debounce = true
  537.                     chargetext.TextColor3 = Color3.new(1,0,0)
  538.                     dancebro = Instance.new("StringValue", game:service'Lighting')
  539.                     dancebro.Name = ('STOPDANCING'..plr.Name)
  540.                     game:service'Debris':AddItem(dancebro, 1)
  541.                     coroutine.wrap(function()
  542.                         repeat wait() until charge >= 10
  543.                         debounce = false
  544.                         chargetext.TextColor3 = Color3.new(1,1,1)
  545.                     end)()
  546.                     coroutine.wrap(function()
  547.                         while not sound.IsPlaying do
  548.                             if charge <= 100 then
  549.                             charge = charge + .1
  550.                             wait()
  551.                             elseif charge > 100 then
  552.                             charge = 100
  553.                             break
  554.                             end
  555.                         end
  556.                     end)()
  557.             else
  558.             charge = charge - .08
  559.             wait()
  560.             end
  561.         end
  562.     end)()
  563.     coroutine.wrap(function()
  564.         local ran,err = ypcall(function()
  565.         while sound.IsPlaying and Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 do
  566.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  567.     if not sound.IsPlaying then break end
  568.     rayCast(speaker, 1250, 0, 5, "Lavender")
  569.     wait(.35)
  570.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  571.     if not sound.IsPlaying then break end
  572.     rayCast(speaker, 1250, 0, 5, "Pink")
  573.     wait(.95)
  574.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  575.     if not sound.IsPlaying then break end
  576.     rayCast(speaker, 1250, 0, 5, "Bright bluish green")
  577.     wait(.55)
  578.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  579.     if not sound.IsPlaying then break end
  580.     rayCast(speaker, 1250, 0, 5, "Pink")
  581.     wait(.4)
  582.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  583.     if not sound.IsPlaying then break end
  584.     rayCast(speaker, 1250, 0, 5, "Bright bluish green")
  585.     local pl = Instance.new("PointLight", torso)
  586.     pl.Color = Color3.new(153/255/1.25, 102/255/1.25, 204/255/1.25)
  587.     pl.Range = 30
  588.     pl.Brightness = 0.7
  589.     game:service'Debris':AddItem(pl, .3)
  590.     wait(.45)
  591.     if Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then stopsound() break end
  592.     if not sound.IsPlaying then break end
  593.     rayCast(speaker, 1250, 0, 5, "Lavender")
  594.     wait(.75)
  595.     end
  596.     end) if err then print(err) end
  597.     end)()
  598. end)
  599.  
  600. mouse.Button1Up:connect(function(mous)
  601.     stopsound()
  602. end)
  603. ctrl = false
  604. mouse.KeyDown:connect(function(k)
  605.     if string.byte(k) == 50 then
  606.         ctrl = true
  607.         humanoid.WalkSpeed = 8
  608.     end
  609.     if string.byte(k) == 48 then
  610.     humanoid.WalkSpeed = 28
  611.     end
  612. end)
  613.  
  614. mouse.KeyUp:connect(function(k)
  615.     if string.byte(k) == 50 then
  616.         ctrl = false
  617.         humanoid.WalkSpeed = 16
  618.     end
  619.     if string.byte(k) == 48 then
  620.     humanoid.WalkSpeed = 16
  621.         if ctrl then
  622.             humanoid.WalkSpeed = 8
  623.         end
  624.     end
  625. end)
  626.  
  627. humanoid.Died:connect(function()
  628.     deathpos = torso.Position
  629.     WorkModel = Instance.new("Model", workspace)
  630.     WorkModel.Name = " "
  631.         wait(1/60)
  632.         humanoid.Parent = nil
  633.     if torso then
  634.         local Head = char:FindFirstChild("Head")
  635.         if Head then
  636.             local Neck = Instance.new("Weld")
  637.             Neck.Name = "Neck"
  638.             Neck.Part0 = torso
  639.             Neck.Part1 = Head
  640.             Neck.C0 = CFrame.new(0, 1.5, 0)
  641.             Neck.C1 = CFrame.new()
  642.             Neck.Parent = torso
  643.         end
  644.         local Limb = char:FindFirstChild("Right Arm")
  645.         if Limb then
  646.  
  647.             Limb.CFrame = torso.CFrame * CFrame.new(1.5, 0, 0)
  648.             local Joint = Instance.new("Glue")
  649.             Joint.Name = "RightShoulder"
  650.             Joint.Part0 = torso
  651.             Joint.Part1 = Limb
  652.             Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  653.             Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  654.             Joint.Parent = torso
  655.  
  656.             local B = Instance.new("Part")
  657.             B.TopSurface = 0
  658.             B.BottomSurface = 0
  659.             B.formFactor = "Symmetric"
  660.             B.Size = Vector3.new(1, 1, 1)
  661.             B.Transparency = 1
  662.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  663.             B.Parent = char
  664.             B.CanCollide = false
  665.             local W = Instance.new("Weld")
  666.             W.Part0 = Limb
  667.             W.Part1 = B
  668.             W.C0 = CFrame.new(0, -0.5, 0)
  669.             W.Parent = Limb
  670.  
  671.         end
  672.         local Limb = char:FindFirstChild("Left Arm")
  673.         if Limb then
  674.  
  675.             Limb.CFrame = torso.CFrame * CFrame.new(-1.5, 0, 0)
  676.             local Joint = Instance.new("Glue")
  677.             Joint.Name = "LeftShoulder"
  678.             Joint.Part0 = torso
  679.             Joint.Part1 = Limb
  680.             Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  681.             Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  682.             Joint.Parent = torso
  683.  
  684.             local B = Instance.new("Part")
  685.             B.TopSurface = 0
  686.             B.BottomSurface = 0
  687.             B.formFactor = "Symmetric"
  688.             B.Size = Vector3.new(1, 1, 1)
  689.             B.Transparency = 1
  690.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  691.             B.Parent = char
  692.             B.CanCollide = false
  693.             local W = Instance.new("Weld")
  694.             W.Part0 = Limb
  695.             W.Part1 = B
  696.             W.C0 = CFrame.new(0, -0.5, 0)
  697.             W.Parent = Limb
  698.  
  699.         end
  700.         local Limb = char:FindFirstChild("Right Leg")
  701.         if Limb then
  702.  
  703.             Limb.CFrame = torso.CFrame * CFrame.new(0.5, -2, 0)
  704.             local Joint = Instance.new("Glue")
  705.             Joint.Name = "RightHip"
  706.             Joint.Part0 = torso
  707.             Joint.Part1 = Limb
  708.             Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  709.             Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
  710.             Joint.Parent = torso
  711.  
  712.             local B = Instance.new("Part")
  713.             B.TopSurface = 0
  714.             B.BottomSurface = 0
  715.             B.formFactor = "Symmetric"
  716.             B.Size = Vector3.new(1, 1, 1)
  717.             B.Transparency = 1
  718.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  719.             B.Parent = char
  720.             B.CanCollide = false
  721.             local W = Instance.new("Weld")
  722.             W.Part0 = Limb
  723.             W.Part1 = B
  724.             W.C0 = CFrame.new(0, -0.5, 0)
  725.             W.Parent = Limb
  726.  
  727.         end
  728.         local Limb = char:FindFirstChild("Left Leg")
  729.         if Limb then
  730.  
  731.             Limb.CFrame = torso.CFrame * CFrame.new(-0.5, -2, 0)
  732.             local Joint = Instance.new("Glue")
  733.             Joint.Name = "LeftHip"
  734.             Joint.Part0 = torso
  735.             Joint.Part1 = Limb
  736.             Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  737.             Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
  738.             Joint.Parent = torso
  739.  
  740.             local B = Instance.new("Part")
  741.             B.TopSurface = 0
  742.             B.BottomSurface = 0
  743.             B.formFactor = "Symmetric"
  744.             B.Size = Vector3.new(1, 1, 1)
  745.             B.Transparency = 1
  746.             B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
  747.             B.Parent = char
  748.             B.CanCollide = false
  749.             local W = Instance.new("Weld")
  750.             W.Part0 = Limb
  751.             W.Part1 = B
  752.             W.C0 = CFrame.new(0, -0.5, 0)
  753.             W.Parent = Limb
  754.         end
  755.         for blood = 0, 3 do
  756.             local blood = Instance.new("Part", workspace)
  757.             blood.BrickColor = BrickColor.Red()
  758.             blood.FormFactor = "Custom"
  759.             blood.Size = Vector3.new(.2,.2,.2)
  760.             blood.Anchored = true
  761.             blood.TopSurface = "Smooth"
  762.             blood.BackSurface = "Smooth"
  763.             local bloodmesh = Instance.new("CylinderMesh", blood)
  764.             bloodmesh.Scale = Vector3.new(3, 0, 3)
  765.             local rayzb = Ray.new(torso.Position, Vector3.new(0, -20, 0) + Vector3.new(math.random(-2, 2), 0, math.random(-2, 2)))
  766.             local hitzb, hitposb = workspace:findPartOnRay(rayzb, char)
  767.             if hitzb then
  768.             blood.CFrame = CFrame.new(hitposb.x,hitposb.y,hitposb.z)
  769.             blood.CFrame = blood.CFrame * CFrame.new(0, .05, 0)
  770.                 coroutine.wrap(function()
  771.                     for cframe = 0, math.random(16, 24) do
  772.                         bloodmesh.Scale = bloodmesh.Scale + Vector3.new(.45, 0, .45)
  773.                         wait()
  774.                     end
  775.                 end)()
  776.             elseif not hitzb then
  777.             blood:Destroy()
  778.             end
  779.         end
  780.         local BP = Instance.new("BodyPosition", torso)
  781.         BP.maxForce = Vector3.new(1,1,1)/0
  782.         BP.position = deathpos
  783.         for i,v in pairs(char:children()) do
  784.             if v:IsA("Part") then v.Parent = WorkModel end
  785.         end
  786.         wait(.3)
  787.         BP:Destroy()
  788.     end
  789. end)
  790.  
  791. local rlegm = Instance.new("Motor", torso)
  792. rlegm.C0 = CFrame.new(0.5, -1, 0)
  793. rlegm.C1 = CFrame.new(0, 1, 0)
  794. rlegm.Part0 = torso
  795. rlegm.Part1 = rl
  796. rlegm.Name = "Right Hip"
  797. local llegm = Instance.new("Motor", torso)
  798. llegm.C0 = CFrame.new(-0.5, -1, 0)
  799. llegm.C1 = CFrame.new(0, 1, 0)
  800. llegm.Part0 = torso
  801. llegm.Part1 = ll
  802. llegm.Name = "Left Hip"
  803. neck.C0 = CFrame.new(0, 1, 0)
  804. neck.C1 = CFrame.new(0, -0.5, 0)
  805. rj.C0 = CFrame.new(0, -1, 0)
  806. rj.C1 = CFrame.new(0, -1, 0)
  807. rsc0 = rm.C0
  808. lsc0 = lm.C0
  809. neckc0 = neck.C0
  810. rootc0 = rj.C0
  811. llc0 = llegm.C0
  812. rlc0 = rlegm.C0
  813. speed = 0.4
  814. angle = 0
  815. anglespeed = 0
  816. mvmnt = 0
  817. game:service'RunService'.RenderStepped:connect(function()
  818.     angle = (angle % 100) + anglespeed/10
  819.     mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
  820.         local rscf = rsc0
  821.         local lscf = lsc0
  822.         local rlcf = rlc0
  823.         local llcf = llc0
  824.         local rjcf = rootc0
  825.         local ncf = neckc0
  826.         local rayz = Ray.new(rootpart.Position, Vector3.new(0, -4.1, 0))
  827.         local hitz, enz = workspace:findPartOnRay(rayz, char)
  828.         --math.asin(mouse.UnitRay.Direction.y)
  829.         ncf = neckc0 * CFrame.Angles(camera.CoordinateFrame.lookVector.y, 0, 0)
  830.         rscf = rsc0 * CFrame.new(-.55, 0, .35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, 0)
  831.         lscf = lsc0 * CFrame.new(.85, 0, -.65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, math.rad(45))
  832.         if firing then
  833.             rscf = rsc0 * CFrame.new(-.55, .15, .65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, 0)
  834.             lscf = lsc0 * CFrame.new(.85, .15, -.35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2, 0, math.rad(45))
  835.         end
  836.         if not hitz then
  837.             ncf = neckc0 * CFrame.Angles(math.pi/18, 0, 0)
  838.                 rscf = rsc0 * CFrame.new(-.45, 0, -.75) * CFrame.Angles(math.pi/5+math.pi/18, 0, math.rad(-70))
  839.                 lscf = lsc0 * CFrame.new(.35, 0, 0) * CFrame.Angles(math.pi/3.5+math.pi/18, 0, 0)
  840.             rjcf = rootc0 * CFrame.Angles(-math.pi/32, 0, 0)
  841.                 rlcf = rlc0 * CFrame.new(0, 0.7, -0.5) * CFrame.Angles(-math.pi/14, 0, 0)
  842.                 llcf = llc0 * CFrame.Angles(-math.pi/20, 0, 0)
  843.         elseif humanoid.Sit then
  844.             ncf = neckc0 * CFrame.Angles(0, 0, 0)
  845.             rjcf = rootc0 * CFrame.new(0, -.2, 0)
  846.             rlcf = rlc0 * CFrame.Angles(math.pi/2, 0, math.rad(7.5))
  847.             llcf = llc0 * CFrame.Angles(math.pi/2, 0, -math.rad(7.5))
  848.             if sprinting then
  849.                 debounceofsprint = false
  850.                 sprinting = false
  851.             end
  852.         elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 2 then
  853.             speed = 0.3
  854.             if ctrl then
  855.                 rjcf = rootc0 * CFrame.new(0, -1.25, 0)
  856.                 llcf = llc0 * CFrame.new(0, 0, -.45) * CFrame.Angles(-math.pi/2.2, 0, 0)
  857.                 rlcf = rlcf * CFrame.new(0, 1.25, -.85)
  858.             else
  859.                 rjcf = rootc0
  860.                 rlcf = rlc0 * CFrame.Angles(-math.rad(.5), 0, math.rad(1.5))
  861.                 llcf = llc0 * CFrame.Angles(math.rad(1.5), 0, -math.rad(1.5))
  862.             end
  863.     elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude <= 20 then
  864.         if not humanoid.Sit then
  865.             anglespeed = 2
  866.             if ctrl then
  867.                 anglespeed = 3
  868.                 ncf = neckc0 * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/18, 0, 0)
  869.                 rjcf = rootc0 * CFrame.new(0, -.35, 0) * CFrame.Angles(-math.pi/18, 0, 0)
  870.                 rscf = rsc0 * CFrame.new(-.55, 0, .35) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2+math.pi/18, 0, 0)
  871.                 lscf = lsc0 * CFrame.new(.85, 0, -.65) * CFrame.Angles(camera.CoordinateFrame.lookVector.y+math.pi/2+math.pi/18, 0, math.rad(45))
  872.                 llcf = llc0 * CFrame.new(0, .45, -.35) * CFrame.Angles(math.pi/18 - math.sin(angle)*.45, 0, 0)
  873.                 rlcf = rlcf * CFrame.new(0, .45, -.35) * CFrame.Angles(math.pi/18 + math.sin(angle)*.45, 0, 0)
  874.             else
  875.                 rjcf = rootc0
  876.                 rlcf = rlc0 * CFrame.Angles(math.sin(-angle)*.65, 0, math.rad(.5))
  877.                 llcf = llc0 * CFrame.Angles(math.sin(angle)*.65, 0, -math.rad(.5))
  878.             end
  879.             if sprinting then
  880.                 debounceofsprint = false
  881.                 sprinting = false
  882.             end
  883.             end
  884.         elseif Vector3.new(torso.Velocity.x, 0, torso.Velocity.z).magnitude >= 20 then
  885.             if not humanoid.Sit then
  886.             anglespeed = 2.7
  887.                 ncf = neckc0 * CFrame.Angles(math.pi/18, 0, 0)
  888.                 rscf = rsc0 * CFrame.new(-.45, 0, -.75) * CFrame.Angles(math.pi/5+math.pi/18, 0, math.rad(-70))
  889.                 lscf = lsc0 * CFrame.new(.35, 0, 0) * CFrame.Angles(math.pi/3.5+math.pi/18, 0, 0)
  890.                 rjcf = rootc0 * CFrame.new(0, 0, 0) * CFrame.Angles(-math.pi/18, math.sin(angle)*.1, math.sin(angle)*.045)
  891.                 rlcf = rlc0 * CFrame.new(0, .3 + -math.cos(-angle)*.3, -.2+math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(-angle)*1.3, 0, math.rad(.5))
  892.                 llcf = llc0 * CFrame.new(0, .3 - -math.cos(angle)*.3, -.05-math.sin(angle)*0.25) * CFrame.Angles(-math.pi/18+math.sin(angle)*1.3, 0, -math.rad(.5))
  893.             sprinting = true
  894.             debounceofsprint = true
  895.             end
  896.         end
  897.     rm.C0 = clerp(rm.C0,rscf,speed)
  898.     lm.C0 = clerp(lm.C0,lscf,speed)
  899.     rj.C0 = clerp(rj.C0,rjcf,speed)
  900.     rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  901.     llegm.C0 = clerp(llegm.C0,llcf,speed)
  902.     neck.C0 = clerp(neck.C0,ncf,speed)
  903. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement