simhwui

Untitled

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