Advertisement
madiik

[ROBLOX] Dubstep Gun

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