Advertisement
Upscalefanatic3

Dubstep Gun

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