Advertisement
Yscripter

Untitled

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