advancedev

AlaStaff

Jan 19th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.27 KB | None | 0 0
  1. --AlaStaff Gifted by machontz, Local Script!
  2.  
  3. --===============Changes===============--
  4. new= Instance.new;
  5. unew= UDim2.new;
  6. vnew= Vector3.new;
  7. fnew= CFrame.new;
  8. cnew= Color3.new;
  9. bcn= BrickColor.new;
  10. look= CFrame.lookVector;
  11. rot= CFrame.fromEulerAnglesXYZ;
  12. --=====================================--
  13.  
  14. Tool=new('Tool')
  15. Tool.Name='AlaStaff'
  16. Tool.GripPos=vnew(0,.5,0)
  17. Tool.TextureId='http://www.roblox.com/asset/?id=54353092'
  18. ToolHandle=new('Part')
  19. ToolHandle.Material=('Wood')
  20. ToolHandle.BrickColor=bcn('Reddish brown')
  21. ToolHandle.Name='Handle'
  22. ToolHandle.formFactor=3
  23. ToolHandle.Size=vnew(.5,6,.5)
  24. ToolHandle.CanCollide=false
  25. ToolHandle.Parent=Tool
  26. Tool.Parent=game.Players.LocalPlayer.Backpack
  27. script.Parent = Tool
  28.  
  29. --================Tool!================--
  30. tool=script.Parent
  31. staff=tool.Handle
  32. SmokePart=nil
  33. --=====================================--
  34.  
  35. --===============Player!===============--
  36. player=nil
  37. if tool.Parent:IsA('Model')then
  38. player=game.Players[tool.Parent.Name]
  39. elseif tool.Parent:IsA('Backpack')then
  40. player=tool.Parent.Parent
  41. end
  42. --=====================================--
  43.  
  44. --================Math!================--
  45. random= math.random;
  46. pi= math.pi;
  47. --=====================================--
  48.  
  49. --==============Services!==============--
  50. debris= game:service('Debris')
  51. workspace= game:service('Workspace')
  52. lighting= game:service('Lighting')
  53. insert= game:service('InsertService')
  54. --=====================================--
  55.  
  56. --===============Changes===============--
  57. new= Instance.new;
  58. unew= UDim2.new;
  59. vnew= Vector3.new;
  60. fnew= CFrame.new;
  61. cnew= Color3.new;
  62. bcn= BrickColor.new;
  63. look= CFrame.lookVector;
  64. rot= CFrame.fromEulerAnglesXYZ;
  65. soul= 0;
  66. --=====================================--
  67.  
  68. clickActive=false
  69. kayActive=false
  70.  
  71. --===========Base Functions!===========--
  72. x=function(f)coroutine.resume(coroutine.create(f))end
  73.  
  74. sing=function(name,parent)
  75. x(function()
  76. mmo=new('Model')
  77. debris:AddItem(mmo,1)
  78. mmo.Name='StaffFunction'..name
  79. V=new('ObjectValue',mmo)
  80. V.Value=player
  81. V.Name='user'
  82. mmq=new('ObjectValue',mmo)
  83. mmq.Name='parent'
  84. mmq.Value=parent
  85. mmc=mmo:clone()
  86. debris:AddItem(mmc,1)
  87. mmc.Parent=lighting
  88. end)
  89. end
  90.  
  91. ko=function(humanoid)
  92. if humanoid:FindFirstChild('creator',true)then return end
  93. k=new('ObjectValue')
  94. k.Name='creator'
  95. k.Value=player
  96. k.Parent=humanoid
  97. player.Character.Humanoid:TakeDamage(-humanoid.MaxHealth)
  98. soul=soul+1
  99. end
  100.  
  101. s1=function(t)
  102. x(function()
  103. clickActive=false
  104. for i,h in pairs(t.Parent:children())do
  105. if h:IsA('Humanoid')then
  106. h:TakeDamage(.1)
  107. if h.Health<=0 then
  108. ko(h)
  109. print'DIE!'
  110. end
  111. return
  112. end
  113. end
  114. t:BreakJoints()
  115. clickActive=false
  116. end)
  117. end
  118.  
  119. s2=function(t)
  120. x(function()
  121. delay(.1,function()s3(t)end)
  122. if t:FindFirstChild('w-')then return end
  123. q=player.Character.Torso.CFrame.lookVector
  124. wq=new('BodyThrust')
  125. debris:AddItem(wq,.2)
  126. x(function()debris:AddItem(t.Smoke,.02)end)
  127. x(function()
  128. smc=Smoke:clone()
  129. debris:AddItem(smc,3)
  130. smc.Enabled=true
  131. smc.Parent=t
  132. end)
  133. wq.force=vnew(40,40,40)
  134. wq.location=vnew(0,100,1)
  135. wq.Parent=t
  136. qwe = Instance.new('BodyVelocity')
  137. debris:AddItem(qwe,.3)
  138. qwe.Name='w-'
  139. qwe.maxForce=Vector3.new(1e7,1e7,1e7)
  140. qwe.P=125
  141. qwe.velocity=(Vector3.new(q.x,q.y,q.z)*100)+Vector3.new(0,30,0)
  142. qwe.Parent=t
  143. clickActive=false
  144. for i,h in pairs(t.Parent:children())do
  145. if h:IsA('Humanoid')then
  146. h:TakeDamage(10)
  147. if h.Health<=0 then
  148. ko(h)
  149. print'DIE!'
  150. end
  151. return
  152. end
  153. end
  154. t:BreakJoints()
  155. clickActive=false
  156. end)
  157. end
  158.  
  159. s3=function(t)
  160. x(function()
  161. if t.Size.x+t.Size.y+t.Size.z<=20 then
  162. t.Anchored=false
  163. end
  164. if staff:FindFirstChild('ow')or staff:FindFirstChild('wq')then return end
  165. pa=new('Part')
  166. debris:AddItem(pa,3)
  167. pa.Name='ow'
  168. pa.formFactor=0
  169. pa.Size=vnew(1,1,1)
  170. pa.Transparency=1
  171. pa.CanCollide=false
  172. pa.Parent=staff
  173. fire=new('Fire',pa)
  174. fire.Size=3
  175. fire.Heat=14
  176. weld=new('Weld',staff)
  177. weld.Part0=staff
  178. weld.Part1=pa
  179. weld.C0=fnew(0,staff.Size.y/1.3,0)
  180. clickActive=false
  181. for i,h in pairs(t.Parent:children())do
  182. if h:IsA('Humanoid')then
  183. h:TakeDamage(20)
  184. if h.Health<=0 then
  185. ko(h)
  186. end
  187. return
  188. end
  189. end
  190. t:BreakJoints()
  191. clickActive=false
  192. end)
  193. end
  194. --=====================================--
  195. tool.TextureId='http://www.roblox.com/asset/?id=54353092'
  196. tool.Activated:connect(function()
  197. if kayActive==true then return end
  198. clickActive=true
  199. mode=mode+1
  200. if mode==2 then
  201. a=new('StringValue')
  202. debris:AddItem(a,1)
  203. a.Name='toolanim'
  204. a.Value='Slash'
  205. a.Parent=tool
  206. elseif mode==3 then
  207. s3()
  208. end
  209. wait(.3)
  210. mode=1
  211. clickActive=false
  212. end)
  213. tool.Equipped:connect(function(d)
  214. pcall(function()staff.CFrame=player.Character['Right Arm'].CFrame end)
  215. d.KeyUp:connect(function(k)if k=='e'then Round=false end end)
  216. d.KeyDown:connect(function(k)
  217. x(function()
  218. if k=='t'then
  219. if clickActive==true then return end
  220. kayActive=true --Rofl
  221. if d.Target==nil then return end
  222. torso=player.Character.Torso
  223. torso.Velocity=vnew(0,0,0)
  224. torso.RotVelocity=vnew(0,0,0)
  225. torso.CFrame=fnew(d.Hit.p.x,d.Hit.p.y+5,d.Hit.p.z)
  226. torso.Velocity=vnew(0,0,0)
  227. torso.RotVelocity=vnew(0,0,0)
  228. Sp.Enabled=true
  229. wait(.1)
  230. Sp.Enabled=false
  231. kayActive=false
  232. elseif k=='p'then
  233. if Poisoning==true then print'Poisoning Active!' return end
  234. Poisoning=true
  235. Pp=new('Part')
  236. Pp.formFactor=0
  237. Pp.Size=vnew(1,1,1)
  238. Pp.Transparency=.9
  239. Pp.Position=d.Hit.p
  240. Pp.BrickColor=BrickColor.Green()
  241. Pp.CanCollide=false
  242. Pp.Anchored=true
  243. new('SpecialMesh',Pp).MeshType='Sphere'
  244. Pp.Mesh.Scale=vnew(50,50,50)
  245. Pp.Parent=workspace
  246. for lw=1,10 do
  247. nPp=new('Part')
  248. nPp.formFactor=0
  249. nPp.Size=vnew(1,1,1)
  250. nPp.Transparency=.9
  251. nPp.CFrame=Pp.CFrame
  252. nPp.BrickColor=BrickColor.Green()
  253. nPp.CanCollide=false
  254. nPp.Anchored=true
  255. new('SpecialMesh',nPp).MeshType='Sphere'
  256. nPp.Mesh.Scale=vnew(4.5*lw,4.5*lw,4.5*lw)
  257. nPp.Parent=Pp
  258. end
  259. debris:AddItem(Pp,200*.2)
  260. delay(0,function()
  261. for RoundNew=1,200 do
  262. wait(.2)
  263. if Pp==nil then break end
  264. pcall(function()
  265. for yy,X in ipairs(game:service('Players'):GetPlayers())do
  266. if X~=player then
  267. pcall(function()
  268. if (X.Character.Torso.Position-Pp.Position).magnitude<30 then
  269. for z,humaa in pairs(X.Character:children())do
  270. if humaa:IsA('Humanoid')then
  271. pcall(function()
  272. newSound=new('Sound')
  273. newSound.Parent=X.Backpack
  274. end)
  275. humaa:TakeDamage(5)
  276. if humaa.Health<=0 then
  277. ko(humaa)
  278. end
  279. end
  280. end
  281. end
  282. end)
  283. end
  284. end
  285. end)
  286. end
  287. pcall(function()Pp:remove()end)
  288. Poisoning=false
  289. end)
  290. elseif k=='e'then
  291. if clickActive==true or kayActive==true then return end
  292. kayActive=true
  293. Round=true
  294. Sp.Enabled=true
  295. soundnew=new('Sound')
  296. soundnew.SoundId='rbxasset://sounds/collide.wav'
  297. soundnew.Pitch=.5
  298. soundnew.Volume=1
  299. repeat
  300. wait(.05)
  301. pcall(function()
  302. for ah,Vplayer in ipairs(game:service('Players'):GetPlayers())do
  303. pcall(function()
  304. if (Vplayer.Character.Torso.Position-d.Hit.p).magnitude<7 then
  305. for l,o in pairs(Vplayer.Character:children())do
  306. if o:IsA('Humanoid')then ko(o)end
  307. end
  308. end
  309. end)
  310. end
  311. pcall(function()player.Character.Torso.CFrame=fnew(player.Character.Torso.Position,vnew(d.hit.p.x,0,d.hit.p.z))end)
  312. Apart=new('Part')
  313. soundnew:clone().Parent=Apart
  314. debris:AddItem(Apart,.3)
  315. Apart.formFactor=0
  316. Apart.Size=vnew(1,1,1)
  317. Apart.Transparency=.2
  318. Apart.CanCollide=true
  319. --Apart.Anchored=true
  320. rand=math.random(1,6)
  321. new('BlockMesh',Apart).Scale=vnew(rand,rand,rand)
  322. Apart.BrickColor=BrickColor.random()
  323. Apart.CFrame=rot(math.rad(math.random(-360,360)),math.rad(math.random(-360,360)),math.rad(math.random(-360,360)))+d.Hit.p+vnew(math.random(-2,2),math.random(-2,2),math.random(-2,2))
  324. Apart.Parent=workspace
  325. pcall(function()Apart.Sound:play()end)
  326. pcall(function()Apart.Sound:play()end)
  327. exp=new('Explosion')
  328. exp.BlastRadius=6
  329. exp.Position=Apart.Position
  330. exp.Parent=Apart
  331. end)
  332. until Round==false
  333. pcall(function()
  334. soundnew:remove()
  335. Sp.Enabled=false
  336. end)
  337.  
  338. kayActive=false
  339. elseif k=='n'then
  340. if clickActive==true then return end
  341. kayActive=true
  342. Smoke.RiseVelocity=20
  343. x(function()
  344. if Smoke.Enabled==true then return end
  345. for i,v in pairs(SmokePart:children())do
  346. x(function()v.Enabled=true end)
  347. end
  348. for b=1,10 do
  349. wait()
  350. for i,v in pairs(tool:children())do
  351. if v==staff then
  352. v.BrickColor=bcn(1003)
  353. v.Material=('Slate')
  354. wait()
  355. v.Material=('Wood')
  356. v.BrickColor=bcn('Reddish brown')
  357. end
  358. if v~=staff and v~=SmokePart and v~=script then
  359. v.Material=('Plastic')
  360. v.Transparency=b/10
  361. if b==10 then
  362. v:remove()
  363. end
  364. end
  365. end
  366. end
  367. for i,v in pairs(SmokePart:children())do
  368. x(function()v.Enabled=false end)
  369. end
  370. Smoke.RiseVelocity=5
  371. kayActive=false
  372. end)
  373. elseif k=='q'then
  374. if clickActive==true then return end
  375. kayActive=true
  376. x(function()
  377. if Sp.Enabled==true then return end
  378. Sp.Enabled=true
  379. Model=new('Model',player.Character)
  380. debris:AddItem(Model,30)
  381. Model.Name='Snare'..random(-999999,999999)
  382. partnew=new('Part')
  383. partnew.Anchored=true
  384. partnew.Shape=0
  385. partnew.Size=vnew(4,4,4)
  386. partnew.Material=('Slate')
  387. partnew.BrickColor=bcn('Bright red')
  388. partnew.BottomSurface=0
  389. partnew.TopSurface=0
  390. partnew.Name='Main'
  391. partnew.CFrame=fnew(d.Hit.p.x,d.Hit.p.y,d.Hit.p.z)
  392. partnew.Parent=Model
  393. for ee=1,6 do
  394. partlist={}
  395. for aa=1,14 do
  396. wait()
  397. p=new('Part')
  398. partlist[aa]=p
  399. p.formFactor=3
  400. p.CanCollide=false
  401. p.Size=vnew(2,2,2)
  402. p.BottomSurface=0
  403. p.TopSurface=0
  404. p.Material=('Slate')
  405. if aa~=1 then
  406. p.BrickColor=bcn(1003)
  407. p.Size=Vector3.new(2,2,2/(aa/10))
  408. end
  409. p.CFrame=partnew.CFrame
  410. p.Parent=Model
  411. if aa==1 then
  412. w=new('Weld',partnew)
  413. else
  414. wq=aa-1
  415. w=new('Weld',partlist[wq])
  416. end
  417. w.Part0=w.Parent
  418. w.Part1=p
  419. w.C0=rot(0,0,.25/-aa)+vnew(p.Size.x/2,0,0)
  420. if aa==2 then
  421. w.C0=rot(0,ee,.2)+vnew(0,.2,0)
  422. end
  423. end
  424. end
  425. for i,v in pairs(Model:children())do
  426. if v:IsA('BasePart')then
  427. v.Anchored=true
  428. v:BreakJoints()
  429. end
  430. end
  431. sing('1',partnew)
  432. Sp.Enabled=false
  433. kayActive=false
  434. end)
  435. end
  436. end)
  437. end)
  438.  
  439. x(function()mainarm=player.Character['Right Arm']
  440. weld=new('Weld',mainarm)
  441. weld.Part0=weld.Parent
  442. weld.Part1=staff
  443. weld.C0=rot(-pi/2,0,0)+vnew(0,-1,.55)
  444. end)
  445. tool.TextureId='http://www.roblox.com/asset/?id=54353092'
  446. mode=1
  447. if z~=nil then return end
  448. z='asd'
  449. for i,v in pairs(tool:children())do
  450. if v~=staff and v~=script then
  451. v:remove()
  452. end
  453. end
  454. x(function()
  455. for cc=1,6 do
  456. for i=1,13 do
  457. wait''
  458. if tool.Parent~=player.Character then
  459. break
  460. end
  461. x(function()
  462. p=new('Part')
  463. p.Name=i
  464. p.formFactor=3
  465. p.CanCollide=false
  466. p.Size=vnew(.6,.6,.6)
  467. p.Material=('Slate')
  468. if i~=1 then
  469. p.Size=vnew(.52+i/200,.52-i/40,.52-i/40)
  470. p.BrickColor=bcn(1003)
  471. end
  472. p.CFrame=staff.CFrame
  473. p.Parent=tool
  474. if i==1 then
  475. w=new('Weld',staff)
  476. else
  477. qn=tool[i-1]
  478. w=new('Weld',tool[i-1])
  479. qn.Name='?'
  480. end
  481. w.Part0=w.Parent
  482. w.Part1=p
  483. if i==1 then
  484. w.C0=rot(0,-pi/2*cc/1.5,.2)+vnew(0,staff.Size.y/2,0)
  485. else
  486. w.C0=rot(0,0,.2)+vnew(p.Size.x/2,0,0)
  487. end
  488. end)
  489. end
  490. end
  491. end)
  492. p=new('Part')
  493. p.Shape=0
  494. p.Name='a'
  495. p.Material=('Slate')
  496. p.Size=vnew(1,1,1)
  497. p.CanCollide=false
  498. p.Parent=tool
  499. w=new('Weld',staff)
  500. w.Part0=staff
  501. w.Part1=p
  502. w.C0=fnew(0,staff.Size.y/2,0)
  503.  
  504. p=new('Part')
  505. p.Shape=0
  506. p.Name='Smoke'
  507. p.Material=('Slate')
  508. p.BottomSurface=0
  509. p.TopSurface=0
  510. p.Size=vnew(1,1,1)
  511. p.BrickColor=bcn(1003)
  512. p.CanCollide=false
  513. p.Parent=tool
  514. Smoke=new('Smoke',p)
  515. Smoke.Size=.01
  516. Smoke.Enabled=false
  517. Smoke.Color=cnew(0,0,0)
  518. Smoke.Opacity=1
  519. Smoke.RiseVelocity=5
  520. Sp=new('Sparkles')
  521. Sp.Enabled=false
  522. Sp.Parent=p
  523. Sp.Color=cnew(1,0,0)
  524. w=new('Weld',staff)
  525. w.Part0=staff
  526. w.Part1=p
  527. w.C0=fnew(0,staff.Size.y/1.3,0)
  528. SmokePart=p
  529. hagal={}
  530. for y=1,4 do
  531. for i=1,20 do
  532. if tool.Parent~=player.Character then
  533. break
  534. end
  535. p=new('Part')
  536. hagal[i]=p
  537. p.formFactor=3
  538. p.Name='q'
  539. p.BrickColor=bcn(1003)
  540. p.Size=vnew(.5,.4,.5)
  541. p.Material=('Slate')
  542. p.CanCollide=false
  543. p.Parent=tool
  544. if i==1 then
  545. w=new('Weld',staff)
  546. else
  547. w=new('Weld',hagal[i-1])
  548. end
  549. w.Part0=w.Parent
  550. w.Part1=p
  551. if i==1 then
  552. w.C0=rot(0,pi/2*y,0)+vnew(0,(staff.Size.y/2)-i*p.Size.y+.2,0)
  553. elseif i<=10 then
  554. w.C0=rot(0,pi/2/i,0)+vnew(.05,-p.Size.y/2,0)
  555. elseif i>10 then
  556. w.C0=rot(.1,pi/2/i*6,0)+vnew(.03,-p.Size.y,0)
  557. end
  558. wait''
  559. end
  560. end
  561. for i,v in pairs(tool:children())do
  562. if v.Name=='Smoke'then
  563. v.Touched:connect(function(a)
  564. x(function()
  565. if a.Parent~=player.Character and a.Parent~=tool then
  566. if mode==1 then
  567. s1(a)
  568. elseif mode==2 then
  569. s2(a)
  570. elseif mode==3 then
  571. s3(a)
  572. end
  573. end
  574. end)
  575. end)
  576. end
  577. end
  578. end)
  579. tool.Unequipped:connect(function()
  580. if tool.Parent:IsA('Backpack')then
  581. for i,v in pairs(tool:children())do
  582. if v~=staff and v~=script then
  583. v:remove()
  584. end
  585. end
  586. end
  587. z=nil
  588. end)
  589. x(function()
  590. player.Character.Humanoid.Died:connect(function()if tool.Parent~=player.Character then tool:remove() return end
  591. if fakestaff~=nil then return end
  592. fakestaff=new('Model',workspace)
  593. debris:AddItem(fakestaff,10)
  594. for i,v in pairs(tool:children())do
  595. if v~=script then
  596. v.Parent=fakestaff
  597. v.Anchored=true
  598. x(function()v.Smoke.Enabled=true end)
  599. x(function()v.Sparkles.Enabled=true end)
  600. end
  601. end
  602. sing('2',fakestaff.Smoke)
  603. fakestaff.Handle:remove()
  604. fakestaff:BreakJoints()
  605. tool:remove()
  606. end)
  607. end)
Add Comment
Please, Sign In to add comment