lolita5432

dupstep gun v2

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