Advertisement
Kaemi

DUBSTEP GUN

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